AppSensei
AppSensei

Reputation: 8400

Add the play script to your PATH in Mac

I'm not good with the terminal, so I have no idea what this means....

you should add the framework installation directory to your system PATH. On UNIX systems, this means doing something like:

export PATH=$PATH:/path/to/play20

On Windows you’ll need to set it in the global environment variables. This means update the PATH in the environment variables and don’t use a path with spaces.

If you're on UNIX, make sure that the play script is executable (otherwise do a chmod a+x play).

Can someone guide me through these steps. I have the Play 2.0 Folder placed in my /Documents.

Upvotes: 1

Views: 9244

Answers (5)

flurdy
flurdy

Reputation: 3972

I would suggest installing Play with Brew if using OS X on Mac.

First install Brew

ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)

Then install Play

brew install play

Open .bash_profile

vi ~/.bash_profile

Ensure that /usr/local/bin is in your path by updating or adding the PATH line to something like this :

PATH=/usr/local/bin:$PATH

Open a new terminal window, and Play should be on your path.

You may also want to install (via brew) Scala, SBT etc.

Upvotes: 9

Beto
Beto

Reputation: 792

This is what I did:

Download the play framework, extracted it to my desktop, open up iterm and vi ~/.bash_profile add path: export PATH=$PATH:/Users/*your-username*/Desktop/play-2.2.0 save the file (that's press esc and type :wq [save and quit]) reload your bash_profile, just type source ~/.bash_profile cd to your directory and type play and your done.

Hope that's helpful.

Upvotes: 7

Marco
Marco

Reputation: 1493

You can edit your ~/.profile file and add:

export PLAY_HOME=your-play-directory export PATH=$PATH:$PLAY_HOME

Upvotes: 1

biesior
biesior

Reputation: 55798

You can also use symlink(s) in /usr/bin to point exact file, this is usefull, when you're using more than one version of play on the system

BTW (I can see that you performed reverse operation in your previous question :) -removed the previous: /usr/bin/play command )

(paste each line separately and confirm):

sudo -i
cd /usr/bin
chmod +x /Users/ronyjohn007/Documents/play-2.0.3/play
ln -ls /Users/ronyjohn007/Documents/play-2.0.3/play play
exit

Other sample - git master in this case

# this creates new folder in your docs, 
# and clones current master version of Play from GitHub to 
# /Users/ronyjohn007/Documents/play-from-github/Play20 folder

cd ~/Documents
mkdir play-from-github
cd play-from-github/
git clone https://github.com/playframework/Play20.git

# this sets alternative command as in sample 1
sudo -i
cd /usr/bin
chmod +x /Users/ronyjohn007/Documents/play-from-github/Play20/play
ln -ls /Users/ronyjohn007/Documents/play-from-github/Play20/play play-master
exit

Finally now you can check which command points to which version:

ls -la /user/bin | grep play

should give something like:

... play -> /Users/ronyjohn007/Documents/play-2.0.3/play
... play-master -> /Users/ronyjohn007/Documents/play-from-github/Play20/play

after terminal reopen they both should be available as common commands.

Note: of course you can't use play command with applications created with play-master new ... and vice-versa!

Upvotes: 1

moonwave99
moonwave99

Reputation: 22810

In export PATH=$PATH:/path/to/play20, /path/to/play20 is a placeholder for your real path, which should be /Users/ronyjohn007/Documents/play20 [drag the folder from Finder into Terminal window for the actual name] - so type:

export PATH=$PATH:/Users/ronyjohn007/Documents/play20

This tells your shell to look into such folder for executables. Then:

chmod +x /Users/ronyjohn007/Documents/play20/play

This gives play file execution permission. Now close and reopen Terminal, and type play followed by enter.

Upvotes: 1

Related Questions