DEV Community

Johnneylee Jack Rollins
Johnneylee Jack Rollins

Posted on

1 1

Fixing MacOS' SSH $PATH missing /usr/local/bin

Originally published to https://johnneyl.ee/writes/

Alt Text

Problem: /usr/local/bin missing from ssh $PATH

bash: docker: command not found

Exec ssh [localhost](http://localhost) docker

Normally, your paths include your /usr/local/bin, however, in macos you'll find that if you SSH into localhost (or indeed any macos host), it is missing. Such is the case when setting up a docker profile with an ssh-based remote host, for example. 🙄

To fix this, we need to safely⚠️ enable an option that's disabled in your sshd_config called PermitUserEnvironment

Solution: /etc/ssh/sshd_config & PermitUserEnvironment PATH,LANG

Edit sshd_config & ~/.ssh/environment

sed -i '' 's/#PermitUserEnvironment no/PermitUserEnvironment PATH,LANG/g' /etc/ssh/sshd_config

Bash:

echo "PATH=/usr/local/bin:$PATH" >> ~/.ssh/environment

Fish:

echo "setenv PATH /usr/local/bin:$PATH" >> ~/.ssh/environment

Conclusion:

🥳 ssh [localhost](http://localhost) docker works!🥳

Now go and cluster all your macbooks together with docker! 🥳

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay