7

I'm trying to add the textmate bundle for coffeescript. I've followed the instructions on github - https://github.com/jashkenas/coffee-script-tmbundle

When I try to compile & display JavaScript I get the following error -

/tmp/temp_textmate.8hqQGD: line 12: coffee: command not found

I'm fairly certain it's due to my path being incorrect in textmate's preferences.

I'm trying to follow the instructions on this question - CoffeeScript TextMate Run Command but I must be doing something wrong as It's not working.

When I do which coffee I get /usr/local/bin/coffee

I've no TM_PATH variable in textmate's preferences only a PATH So, what should I put in my PATH variable in textmate? I currently have /usr/bin:/bin:/usr/sbin:/sbin

I've tried changing it to /usr/local/bin/ but when I try to run a command I get

/Applications/TextMate.app/Contents/SharedSupport/Support/lib/bash_init.sh: line 27: dirname: command not found 

Any ideas?

Community
  • 1
  • 1
Finnnn
  • 3,530
  • 6
  • 46
  • 69

3 Answers3

19

Add /usr/local/bin/ to the existing path, instead of replacing it entirely:

/usr/local/bin/:/usr/bin:/bin:/usr/sbin:/sbin

should work for you. Personally, I'm using

~/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

and the bundle is working correctly for me:

enter image description here

Jeremy
  • 1
  • 85
  • 340
  • 366
  • Thanks, that worked. I didn't really understand the formatting of the path. I presume the colons separate paths? – Finnnn Aug 09 '11 at 10:56
  • 2
    Yup, [it's described on Wikipedia](http://en.wikipedia.org/wiki/PATH_(variable)). – Jeremy Aug 09 '11 at 10:56
3

Use

echo $PATH

on the command line to see your current path. Copy+paste that into TextMate's preferences as the TM_PATH.

Bonus tip: Add a NODE_PATH variable to your TextMate preferences and paste your $NODE_PATH in if you want require statements to use the same paths in TextMate that they do from the command line. Here's my setup:

enter image description here

Trevor Burnham
  • 76,828
  • 33
  • 160
  • 196
  • Thanks for the NODE_PATH tip. Unfortunately the image doesn't show the full path. On my machine, with node installed locally this is: PATH "/Users/dave/local/node/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" and NODE_PATH "/Users/dave/local/node:/Users/dave/local/node/lib/node_modules". You can check these values by typing "set" in terminal which will display a list of your environment variables. – David Clarke Aug 11 '11 at 09:33
  • Right, you wouldn't want to copy my `PATH` and `NODE_PATH` values directly anyway. Just check them in your shell, either using `set` or `echo $PATH` and `echo $NODE_PATH`. – Trevor Burnham Aug 11 '11 at 14:23
2

you have to add /usr/local/bin to your path and not override your path with only /usr/local/bin

so your path should look like: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

edit: you can add it like that: PATH=$PATH:/usr/local/bin

Fender
  • 3,055
  • 1
  • 17
  • 25