Sublime Forum

How do I get Sublime to look in /usr/local/bin?

#1

I have written a program in python which uses Selenium and a driver which is located in /usr/local/bin.

When I run from the program from the command line all is fine. When I run through Sublime I get the error:

FileNotFoundError: [Errno 2] No such file or directory: ‘geckodriver’

at the bottom it states:

[path: /usr/bin:/bin:/usr/sbin:/sbin]

So I’m guessing it is not looking in /usr/local/bin where the driver is located. Am I right? and if so how do I get Sublime to look in /usr/local/bin?

0 Likes

#2

I actually just found the answer.

The fix was to install https://packagecontrol.io/packages/Fix%20Mac%20Path

I installed it through the package control and it’s called Fix Mac Path.

It does seem a bug that you have to install this to make ST3 work the way it should, but then there maybe a very valid reason why it doesn’t, I don’t know, I’m just rambling on.

0 Likes

#3

Under MacOS, the path given to applications launched from the GUI get their path set by launchctl but applications started from the terminal get their path set from .bashrc as you might expect.

As a result unless you start Sublime from the terminal instead of the GUI it doesn’t get the path that you expect. The plugin you mentioned fixes the problem by setting up the path with what it would have been had you launched it from a terminal.

Technically not a bug and this works the way Apple wants it to work, but still annoying.

3 Likes

#4

The next buid of Sublime Text will allow users to expose their shell environment to the Python environment. Currently that doesn’t happen because of the way that OS X launches applications. They are launched by the Dock process, which doesn’t use your shell or any environment variables from it.

3 Likes

#5

4 months later, still looking forward to this :hushed:

I hope it is smart about which shell is relevant. e.g. my macOS user has /bin/sh configured as its shell and not /bin/bash (and hence my config is in ~/.profile).

0 Likes

#6

Yes, we query the OS for your default shell. And yes, we do have a new build coming soon!

7 Likes