0

I am trying to open up files from my terminal using atom. Which resulted in -bash: atom: command not found. I then followed, installing the shell commands from the editor. That resulted in "EEXIST: file already exists, mkdir '/usr/local/bin'" . I've previously tried to follow other recommendations on how to add the subl alias and I guess I tried way too many things, that I didn't understand. Could I have messed up my $PATH ?

When I echo my path this is what it is /bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin.

My bash_profile looks like this when I opened it with nano:

export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH export EDITOR='subl -w'

I don't remember if I added that first line when I tried adding subl.

Should I remove that? I'm also using a MacOS High Sierra.

UPDATE I removed what I had previously added in my .bash_profile and my path is now: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin.

I then ran the command: sudo ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom but got a ln: /usr/local/bin/atom: No such file or directory error

nrvaller
  • 353
  • 6
  • 18
  • have you tried 'source .bash_profile' and then try your commands. – Natsfan May 16 '18 at 18:08
  • @jmh just tried that out. Then both the atom, and subl commands and it doesn't find them. – nrvaller May 16 '18 at 18:11
  • to run sublime text by typing subl i have the following line in my .bash_profile : ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl – Natsfan May 16 '18 at 18:12
  • try typing 'which atom' and see what you get. Probably nothing. – Natsfan May 16 '18 at 18:14
  • i see you have an answer. i hope that helps you. – Natsfan May 16 '18 at 18:15
  • @jmh yep, I got nothing. I updated my question with the suggestions from the answer provided. My path is now different. I also uninstalled atom and installed it again but face the same errors. – nrvaller May 17 '18 at 15:49

1 Answers1

0

You can remove the export PATH statement from your .bash_profile; it doesn't add anything that isn't already there. (Except maybe /usr/local/sbin, but I would remove that until you can demonstrate a need for it.)

Initially, PATH will include the directories listed in /etc/path:

% cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Any of your shell configuration files can add to the PATH. Assuming you haven't significantly altered your configuration, /etc/profile will run path_helper to add any directories listed in files under /etc/paths.d.

You only need to update PATH if you need to add a directory that is not already there. If atom is located in one of the above paths, you don't need to do anything. It sounds like you attempted to create /usr/local/bin when it already (as it should) exists, then perhaps did not ultimately create the symlink for atom under /usr/local/bin.

Try running just the ln command from the question you linked (using sudo if necessary), then confirm that /usr/local/bin/atom does indeed exist.

chepner
  • 497,756
  • 71
  • 530
  • 681
  • Okay I erased what was in my `.bash_profile` now my path is, `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin`. I then ran the command: ` sudo ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom` but got a `ln: /usr/local/bin/atom: No such file or directory` error. @chepner – nrvaller May 17 '18 at 15:45
  • That's odd; it sounds like `/usr/local/bin` does not exist. Does `sudo mkdir -p /usr/local/bin` still give you an error? – chepner May 17 '18 at 16:12
  • yeah it does.. it says: `mkdir: /usr/local/bin: Input/output error`. Also I resetted my `$PATH` by following the instructions [here](https://shellzero.wordpress.com/tag/reset-path-on-mac/) and now my `$PATH` is `/usr/bin:/usr/sbin:/bin:/sbin` – nrvaller May 17 '18 at 16:37
  • 1
    OK, the `PATH` is not the issue. The problem is that (for whatever reason) you cannot create the link to `atom.sh` that path lookup will eventually find in `/usr/local/bin`. – chepner May 17 '18 at 16:48