How to Install Play Framework in OSX

Posted September 28th, 2011 at 09:03 PM by Aren Patel

There are numerous ways to install Play Framework in Mac OSX; for simplicity sake I will show you how to do so using the Homebrew package manager for OSX.

The first thing you need to do is install Homebrew this can be done by running the command on line one below. Once Homebrew is installed, MongoDB can be easily installed by executing the second command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
brew update
brew install play

Play Framework should now have installed. To verify correct install the following should appear:

$ play
~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~ play! 1.2.3, http://www.playframework.org
~
~ Usage: play cmd [app_path] [--options]
~ 
~ with,  new      Create a new application
~        run      Run the application in the current shell
~        help     Show play help
~

Now you can generate your play application by running

play new app_name

By default play will utilize Java. If you would like to install play with support for Scala, you need to do:

brew install scala
play install scala-0.9.1

To generate a Play Framework Scala application, you must use:

play new app_name --with scala
cd app_name
play run

After running the commands above you should be able to visit your new Play application via your browser - just go to http://localhost:9000/ (9000 is the default port play will run on)

For more info visit the Scala portion of the Play Framework website: http://scala.playframework.org/

Comments: