Reputation: 151
To explain, I have OSX and I wanted to install PLT Racket. I don't know how to use the raco command to run .rkt files in the terminal instead of using the Dr. Racket interpreter. I don't really like the DrRacket text editor.
Where do I put the bin, lib, and other folders? I can't seem to access the raco command at all or any of the other commands in the Racket bin.
Upvotes: 15
Views: 3524
Reputation: 12023
Don't move subcomponents around. This potentially breaks Racket, which expects the bin directory to be in a certain place relative to its libraries.
Instead: add the Racket bin directory to your PATH. See Set environment variables on Mac OS X Lion or Setting environment variables in OS X? for more details on setting up environment variables in Mac OS X.
For example, I personally have Racket 5.2 under "/Applications/Racket v5.2/". I have a ~/.profile with the following contents:
mithril:~ dyoo$ cat .profile
## Adding Racket 5.2 to my PATH
export PATH=/Applications/Racket\ v5.2/bin:$PATH
## .. other contents omitted
After a re-login, I can see Racket from the Terminal:
mithril:~ dyoo$ which racket
/Applications/Racket v5.2/bin/racket
I have one additional file, the ~/.MacOSX/environment.plist, whose contents define more environment variables for graphical programs. Mine has the following contents:
mithril:~ dyoo$ cat .MacOSX/environment.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>MANPATH</key>
<string>/usr/local/man:/usr/share/man:/usr/local/share/man:/usr/X11/man</string>
<key>PATH</key>
<string>/Users/dyoo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/Applications/Racket\ v5.2/bin</string>
</dict>
</plist>
Having this file lets me run Racket from graphical programs that don't inherit their environment from the .profile login file.
Upvotes: 21
Reputation: 8523
If you just want to run a program in a .rkt
file, you probably want to use the racket
program instead of raco
. For example, if you have hello.rkt
type in racket hello.rkt
, assuming it's in your path. Raco is mainly a tool for development (like creating executables). See the intro section of the Guide for more information on running programs.
Upvotes: 2
Reputation: 49803
You can just cd into the Racket/bin directory and execute it from there (you might need to specify ./raco if . isn't in your path). Or you could specify the full path to raco (can't help you w/ that as I don't know where you installed it).
Upvotes: 3