Sublime Forum

Newb question: Linking Sublime Text 2 to GitHub Desktop (OSX)

#1

This is probably a dumb question, but I’m quite new to MacOS.

I’ve got GitHub Desktop and SublimeText2 installed on my iMac and Macbook. I managed to link ST2 to GHD fine on my laptop, but when I try to paste the suggested line into the terminal, I get an error.

ln -s “/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl” ~/bin/subl

Returns

ln: /Users/Ben/bin/subl: No such file or directory

$PATH returns the following…

-bash: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: No such file or directory

What am I doing wrong?

0 Likes

#2

Make sure there is a directory named bin in your home directory (the ~ in ~/bin/subl is expanded to your home directory. It looks like ln is complaining because it can’t create the link because part of the destination path is missing.

That sort of looks like you’re trying to run $PATH from the command line. What you probably meant to do was echo $PATH to see what the path is set to. However, in this case it’s sort of doing what you want anyway; the shell expands $PATH to the actual path and then tries to run it (which it can’t), and then bash displays the name of what it tried to run.

1 Like

#3

Ah, that’s all good to know, thank you so much.

It has now run the command OK, and I have a file “subl” in folder Ben/bin/.

I have not added that new Ben/bin/ directory to my PATH, but /etc/paths includes /usr/bin, so is that the same thing?

Also, although I’ve run the command to associate ST2 with GitHub Desktop…
git config --global core.editor "subl -n -w"
I can’t see changes I make to files reflected in GitHub Desktop.

Sorry if these are stupid questions! Any advice??

0 Likes

#4

Certainly not! We were all new to this sort of thing at one time or another.

You might think that usr stands for “User”, and in fact that’s how a lot of people tend to pronounce it when they say the path out loud, but it actually stands for ***U***nix ***S***ystem ***R***esources. So the short version is, no they’re not the same path, so you should add /Users/Ben/bin to your path.

An alternative to that would be creating the symlink in your /usr/local/bin folder instead, but that requires admin privileges so it’s probably not worth it for the extra steps involved, especially if you’re new to this kind of thing. If you keep your personal changes in your own home directory, things will still work if you (for example) recover from a backup or some such.

The command that you executed tells the command line git tool that whenever it wants you to edit a file (enter commit message, resolve a merge conflict, etc) it should run sublime as the tool to do that (-n tells it to open a new window first and -w tells it to wait until you close the window before it returns back to the shell). That command is correct and will do what you want; at least from the command line.

If Github Desktop is smart enough to use the command line git tools and their configuration, then everything should be as you want it, I would think. That assumes that it doesn’t have its own built in editor for messages, though. I’ve never used Github Desktop before so I’m not really familiar with it’s operation.

2 Likes

#5

Thanks so much for that info!

I managed to wipe my PATH first, but then recovered it and it seems okay. Ran the scripts and no complaints.

I still don’t see edits flagged up in GHD, but I’m guessing there’s something obvious I’m missing… Grr.

1 Like