[racket] running racket from the command line

22 views
Skip to first unread message

Matthew Johnson

unread,
Oct 21, 2013, 3:59:24 AM10/21/13
to us...@racket-lang.org
Dear List, 

I just downloaded the Racket binaries and installed them. I have been able to fire up DrRacket, however given that i prefer vim i was hoping to run racket from the command line. 

I've tried 

$ racket  and $ which racket

but the command is not found. Is there some linking step that i've missed? or is it not possible to run racket from the command line? 

thanks for your help

matt

Norman Gray

unread,
Oct 21, 2013, 4:30:26 AM10/21/13
to Matthew Johnson, us...@racket-lang.org

Matt, hello.

On 2013 Oct 21, at 08:59, Matthew Johnson <mcoo...@gmail.com> wrote:

> I just downloaded the Racket binaries and installed them.

Ah, but where have you installed them?

> I have been able
> to fire up DrRacket, however given that i prefer vim i was hoping to run
> racket from the command line.
>
> I've tried
>
> $ racket and $ which racket

I take it, then, that you're on a unix. On OS X for example, the relevant bin/ directory is located in the same directory as DrRacket.app, and so that's the directory (.../Racket\ v5.3.6/bin) that has to be (explicitly) added to your path. I don't know the layout of the various Linux distributions, but I imagine there's a broadly similar layout there.

Best wishes,

Norman


--
Norman Gray : http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK


____________________
Racket Users list:
http://lists.racket-lang.org/users

Matthew Johnson

unread,
Oct 21, 2013, 4:50:52 AM10/21/13
to Norman Gray, us...@racket-lang.org
Thanks very much. Working well now.

For those that find this, a trap for young players is that you must
quote paths with spaces in them, else you will lose everything you
depend upon (even the command 'ls').

So it is

Export PATH="/Applications/Racket v5.3.6/bin":$PATH

mj

Greg Hendershott

unread,
Oct 21, 2013, 2:20:53 PM10/21/13
to Matthew Johnson, us...@racket-lang.org
Early on using Racket, like you I had some trouble or other quoting. I
adopted the perhaps dubious habit of, right after installing a new
version, renaming to e.g. /Applications/Racket_v5.3.6" -- i.e. " " ->
"_".

Matthew Johnson

unread,
Oct 21, 2013, 2:23:49 PM10/21/13
to Greg Hendershott, us...@racket-lang.org
Thanks - good tip. I don't suppose there some awesome one liner that
does this for all working directory paths?

Ryan Culpepper

unread,
Oct 21, 2013, 2:45:58 PM10/21/13
to Matthew Johnson, us...@racket-lang.org
(for ([dir (map path->string (directory-list))])
(define newdir (string-replace dir " " "_"))
(unless (equal? dir newdir)
(rename-file-or-directory dir newdir #f)))

or

for dir in *; do
newdir=`echo "$dir" | tr " " _` ;
if [ "$dir" != "$newdir" ] ; then mv -i "$dir" "$newdir" ; fi ;
done

Feel free to delete newlines from either bit of code until it becomes a
one-liner :)

Ryan
Reply all
Reply to author
Forward
Message has been deleted
0 new messages