Installing a Grails Development Environment on OS X


Updated for Grails 2.3.x
Video #4: In this Grails Example, we will set up our development environment on an OS X environment.

This first video shows you how to install Grails and Java on OS X. To install Grails, you will need a Java Developers Kit (www.apple.com), and the Grails libraries (www.grails.org). This video will show you how to download and install both. We will be using the Groovy Environment Manager (GVM) to easily install the latest version of Grails.

Subscribe to Grails Academy Magazine.

Video #5: In the second video, you learn how to install an Integrated Development Environment (IDE) based on Eclipse called the Groovy/Grails Tool Suite. This tool is pre-configured for Groovy and Grails to give you features such as syntax highlighting and code completion. The video shows you how to install it and configure it for the Grails 2.1.1 environment that you installed in the previous video.

44 thoughts on “Installing a Grails Development Environment on OS X

  1. Any advice on this particular error?

    | Compiling 143 source files.
    | Error Compilation error: startup failed:
    /Users/okcomputer/grailsapps/demo/target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy: -1: Repetitive method name/signature for method ‘java.lang.Object withFormat(groovy.lang.Closure)’ in class ‘grails.plugin.databasemigration.DbdocController’.
    @ line -1, column -1.
    /Users/okcomputer/grailsapps/demo/target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy: -1: Repetitive method name/signature for method ‘java.lang.Object withFormat(groovy.lang.Closure)’ in class ‘grails.plugin.databasemigration.DbdocController’.
    @ line -1, column -1.
    2 errors
    okcomputer@thegibson:~/grailsapps/demo$

    As far as i can tell its some kind of DB error, but this is my first attempt installing grails. Also, this is Java8 on osx10.9, should I revert to java 7 or 6 and try again?
    Thanks

    • Yes, the first thing I would do is downgrade Java. I have had may problems with incompatible Java versions on OSX. I have been most successful with the version that auto-installs when you enter a Java command at the terminal. If the auto install no longer triggers, get the most current version from the support page on apple.com.

    • Just another follow-up on this. Grails 2.3 will not run under Java 8 on any platform. Java 8 will not work with Grails until 2.4 is released.
      ~Mike

  2. When I try to configure Grails installation under users/username/grails/grails_app I received the message: Specified directory does not appear to be a Grails installation.

    • Alice – which Grails command caused you to get that error? It looks like the create-app command did not succeed as it is not seeing a grails application in that subdirectory.

  3. Thank you for the excellent video on installing Grails on OS X. I viewed the video to verify my grails installation which is exactly the same as shown, except I am using Grails 2.3.5. I am baffled because when I run the demo application, I see the “Error generating web.xml file” message rather than the “Server running” as shown in the video.

    I have searched the web and found nothing helpful. Is this error message due to a configuration issue? Or is it a Tomcat bug, as the stack trace shows…
    org.apache.xml.serializer.utils.WrappedRuntimeException: org.apache.xml.serializer.ToXMLSAXHandler cannot be cast to org.apache.xml.serializer.SerializationHandler

    Or, could it be that my MacBook with 4Gb memory is insufficient to run Grails?
    I am clueless….Thanks.

    • Hi Tom:

      I’ve had issues on the Mac with Java. I have found that installing the latest version of Oracle Java 6 works best with Grails as opposed to Java 7. 4GB of RAM should be plenty.

      Mike

  4. i am installing grails through this video
    i have done till export window and then :wq
    closed that terminal
    opened up a new to check the version as per your video
    the java -version is working and giving me the appropriate version
    but grails -version is not working.. it says grails command not found
    whats the issue now ?

  5. hola, excelente video! gracias por la aportación, podrias hacerlo en español o con subtítulos por que no le entiendo muy bien… cuando haces el grails-2.2.2 y enseña a configurarlo con mysql por favor

  6. Just in case you were curious, vim is Vi iMproved. Its an extended version of VI, runs the same commands, but has slight modifications to it.

  7. Very nice, thank you. But, I wouldn’t set GRAILS_HOME in the .bash_profile to a specific grails version. Instead I would create a soft link in the grails directory that points to the current used version of grails, like this:

    ln -s /users//grails/grails-2.2.0 /users//grails/grails

    The main advantage is, in case of a new grails version, you only need to update the soft link and don’t need to update your .bash_profile or other files.

  8. Love your videos. I tried installing Groovy/Grails Tools Suite (Version: 3.1.0.RELEASE
    Build Id: 201210061306) on Mac OS X 10.6.8(not Mountain Lion) but keep getting this error:
    Error Error loading plugin manager: Could not create a new instance of class [ResourcesGrailsPlugin]! (Use –stacktrace to see the full trace)

    any ideas??
    Thanks

  9. Love the video. I was wondering if you have to have Mountain Lion to run the newer version of Grails. I am running on Snow Leopard (yea I am behind) and when I follow the video exactly and type “grails -version” in my terminal, I get “command not found”.

    • My first videos were on Snow Lion and it worked fine. The message you are getting is because your path must not be set up. Try to change directories into the bin directory under where Grails is installed. If the commands work there, you just need to add the path to your profile. I think OS X stores the bash profile in a different place than Mountain Lion though.

  10. my mac does not show whether its 32 bit or 64 bit… at least not the you showed in the video…

    System Software Overview:

    System Version: OS X 10.8 (12A269)
    Kernel Version: Darwin 12.0.0
    Boot Volume: Macintosh HD
    Boot Mode: Normal
    Computer Name: Vikram’s Mac mini
    User Name: Shantanu Nanoty (snanoty)
    Secure Virtual Memory: Enabled
    Time since boot: 5:13
    this is what is displayed..

    • Thanks for the input. I just updated the videos for Grails 2.1 and include that now. Also, if you are following the course and stay in the Eclipse environment, the IDE takes care of those.

  11. Howdy. Very nice website!! Man .. Excellent .. Amazing .. I’ll bookmark your website and take the feeds additionally…I’m glad to find so much useful information here in the post. Thank you for sharing..

  12. Excuse me, but I attempted to email you regarding an issue on your site but the given email address did not work. Is there some other place I could get in touch with you?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>