M1/M2: can't add link to /usr/bin

I already understand that /usr/local/bin should generally be used for local customization. The problem I have is that nearly a 1000 of my node.js files set the shebang as: "/usr/bin/node". All I want to do is add a link to /usr/bin as root user:


    # cd /usr/bin; ln -s ../local/bin/node


That's it! That one link would otherwise save me from having to change all those shebangs in those nearly 1000 files.


How can I add this link to /usr/bin?


[Edited by Moderator]

MacBook Pro 16″, macOS 13.2

Posted on Jan 30, 2023 12:19 PM

Reply
10 replies

Feb 5, 2023 9:05 AM in response to gpsfreak

Feedback - macOS - Apple


But do not expect they are going to change. Putting the macOS installed bits onto a read-only volume increases security for the vast majority of users that never play with the Terminal.


I suppose you could boot into recovery mode, mount the macOS read-only partition Read/Write and create your symlink, but I do not know how that would go over, and whether or not macOS does a signature check on anything in the read-only volume when it boots or not. I also do not know what happens to your symlink when Apple does a macOS update, or on the next major upgrade. Feel free to experiment.

Feb 6, 2023 2:46 PM in response to gpsfreak

Send your feedback using the above link. But in the short term (and most likely forever) you will have to modify your shebang values.


As we are just volunteers here, there is nothing we can do about this except make suggestions.


The one other avenue you can explore is 'firmlinks'. Google 'macOS firmlinks'. There may be a way to "Sister" read/write directory to the read-only directory via firm links. This is TOTAL speculation, as I am not sure it can be done. Then again, /Applications is a mix of apps stored on the Read-Only partition


https://derflounder.wordpress.com/2020/01/18/creating-root-level-directories-and-symbolic-links-on-macos-catalina/


https://derflounder.wordpress.com/2020/01/18/creating-root-level-directories-and-symbolic-links-on-macos-catalina/


You may have to experiment beyond what the above 2 links describe. Than again, maybe Apple only reserves Sistering 2 directories for themselves.

Jan 30, 2023 2:29 PM in response to BobHarris

Bob,


As I noted, I already understand I have the option to change nearly 1000 node.js files with updated Shebang path for node from /usr/bin/node to /usr/local/bin/node.


I'm not the only only node developer with this problem.


I guess the question now is how to let apple know this majorly ***** for node developers who just bought new macbook pro laptops. Apparently, adding a link to /usr/bin would have been possible after disabling SIP with pre-Catalina os machines.




Greg


[Edited by Moderator]

Feb 6, 2023 5:50 PM in response to gpsfreak

gpsfreak wrote:

As I noted, I already understand I have the option to change nearly 1000 node.js files with updated Shebang path for node from /usr/bin/node to /usr/local/bin/node.

One would think you could do that in a couple of seconds.

I guess the question now is how to let apple know this majorly ***** for node developers who just bought new macbook pro laptops.

Node developers are not Apple's target market. Terminal users aren't even Apple's target market. What you have in /usr/bin right now is only due to Apple's 20 years of technical debt and unwillingness to take a crowbar to their wallet and hire people to pay it off.


Apple sure isn't going to add to that debt with node. I see IT folks regularly freak out over some obscure bug in Apache or git that Apple hasn't patched in a few months. Considering what node is, even if Apple did want to ship it with the operating system, they couldn't put it in /usr/bin. They would have to put it in one of the areas that is more easily patched. Or worse, they would ship that 7 month-old version of node and you wouldn't be able to upgrade it! Choose your poison.



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

M1/M2: can't add link to /usr/bin

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.