Q. Are coconuts considered a nut as regards the 10 days? They are botanically a fruit, just as peanuts are a legume (and people stay away from peanuts in 10 days).
(similar question) I have dietary restrictions and one of the few foods I like and I can eat are cashews. Can I eat them on Rosh Hashana?

A. on question 213 regarding sunflower seeds we wrote “There are a number of reasons mentioned for not eating nuts on Rosh Hashono; a) Egoz, usually understood as walnuts, carries the same gematria as “chet “ or sin, without the non-essential alef (Remo O.H. 583:2). This would restrict the proscription to walnuts.
b) Nuts cause disturbing phlegm, coughing and expectoration, something you want to avoid during Rosh Hashono communal prayers and Shofar blowing (ibid.). This reason may apply to other dry nuts or seeds.
c) Am Yisroel is compared to an Egoz, like the shell covered nut, they can wallow and reel in the mud of Golus and still maintain it’s internal uprightness and integrity (Midrash Shir Hashirim 6:11). Since eating the nuts will remind us of Golus, they constitute an unwanted Siman, we therefore avoid them (Chasam Sofer notes ibid.). This reason would apply only to nuts or seeds with a protective shell.
d) Egoz is the Roshei Teivos (first letters) of the verse Af Gam Zois, included in the Tochacha, also a bad Siman during these days (Chasam Sofer ibid.). This would be relevant only to walnuts.
e) The Egoz tree in Sefer Chasidim is the abode to Mazikim (demons and evil spirits) (Daas Torah ibid.), again pertains to walnuts only.
f) Yalkut Haggershuni (O.H. ibid.) says that the egoz is linked to the angel of forgetfulness, something to avoid in the Yom Hazikaron, day of remembrance as Rosh Hashono is also known.
Mate Ephraim (583: 3) and Nitei Gavriel (Rosh Hashana 28:14) include in this tradition legumes (kitnios) and beans (pulin), Shulchan Oruch Horav (ibid. 10) includes almonds, Piskey Teshuvos (ibid. note 37 discusses pistachio nuts, sunflower and other seeds and whether this applies to cooked nuts and legumes.
Horav Shlomo Miller’s Shlit”a opinion is that if you have an established family tradition you should observe it, otherwise since this is only a minhag, it suffices to restrict oneself from eating nuts.”
The Rov’s opinion is that there does not seem to be a minhag not to eat coconuts, but because of the connotation inherent in the name, he recommends for those who keep the minhag to abstain. The Rov pointed out to Tosafos (Zevachim 72b) “Egoize Perech” and the different types it includes.
If someone due to dietary restrictions requires eating cashews, he may grind them and mixed them with other foods.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit’a