Sponsorships for the upcoming Klalim, which discuss the 39 melachos of Shabbos, are available. Please contact Rabbi Reingold for more information at rabbireingold@gmail.com or 301.996.5910
We are beginning siman 8. We have learned that Chazal were concerned that should one interface with vegetation attached to the ground, they may come to transgress the melacha of kotzair. We discussed the example of smelling a nice-smelling fruit which is attached to the ground. Chazal were concerned that, should one smell it, they may be enticed to detach it in order to eat it.
Thus, the Chayei Adam writes that one cannot smell a fruit which is attached to the ground, out of concern that they may decide to eat it. However, one may smell flowers, since they are not edible and one does not gain by detaching them. One stands to gain by detaching an edible fruit, so Chazal enacted an issur to smell such a fruit.
There is an advantage to detaching a non-edible fruit, which is that now it is portable. However, Chazal were not concerned about this possibility, because its primary function (smell) is usable when attached.
An interesting question which comes up in this context is whether one recites the bracha of hanosein reiach tov bapeiros when walking into an orchard of nice-smelling fruits on Shabbos. The Pri Megadim writes that there is a concern of making a bracha since one is not allowed to smell them. To be clear, the smell itself is not inherently assur, but rather the act of smelling is assur on Shabbos. Therefore, the fact that one is walking through and the smell wafts to him is not an issur; the issur would only apply if one were to purposefully walk up to a fruit in order to smell it.
One suggestion is that, generally, one only makes the bracha when the primary usage of the fruit is for smelling. If the primary use of the fruit is for eating, the bracha is not made. When one picks up a fruit for the purpose of smelling it (not on Shabbos), they change its function from being for eating to smelling. If the item is still attached, the primary purpose of it being attached is for food usage.
If so, either way one does not make a bracha. If they smell it when entering the orchard, one does not make a bracha since they are for food. And one may not hold it in order to smell it, even without detaching it, as it is muktzah. Therefore, there is no scenario where he can say the bracha of hanosein reiach tov bapeiros.
Summary
It is assur to smell an edible fruit which is attached to the ground, it is muttar if it does not have a smell.
One would not make the bracha of hanosein reiach tov bapeiros when the smell of an edible attached fruit wafts to a person on Shabbos