Category Archives: Code

Developing CQ5 on Mavericks

I’m lucky enough to have a MacBook Pro provided to me by the company I currently work for. This is used mainly to develop front end code for CQ5.3 components. I have full admin rights as the IT department refuses to acknowledge any Apple products on their system. To this end I can install pretty much what I like on it. I don’t take the piss and only install kit I actually need and use every day.

  •  Sublime Text 2
  • Codekit
  • Cornerstone (SVN client)
  • Adobe Web suite 6 (not CC)

I was stupidly tempted to update to Mavericks one sunny morning. I’ve heard good reports that its a great OS and I still think that, however on trying run my local CQ instance I was informed that I needed to get a java RTE and was sent off to the Oracle site. Mmmm no java, nice. My normal modus operandi at this point is to stomp around the room a bit and then revert back to the previous OS, with all that entails.  However I’ve decided to try and stick with it and get things up and running again on Mavericks.

Having been bitten before by installing the default v7 of Java (falls over badly with CQ), I hunted around and found the Apple support page that had the latest Apple supported Java

Installed, ran, and Boom we’re off and running again, now able to run local instances on Mavericks.

java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

That was way too easy.

Trying to run a Maven build suddenly reports that I don’t have Maven installed!
WTF, why has that been dropped as well?

Now to install Maven back in.
Off to get the latest and greatest from the maven boutique:

Shoved it in a maven folder inside my root user folder and expanded it. Didn’t even use command line just double clicked it and it was done. Sweet.
Next we need to tell terminal where the path to maven is. This is done with a “bash_profile” file that terminal will load every time you fire it up.
I created the file in the root of my user folder called .bash_profile. I did this by navigating to the root of my user folder by typing “cd ~/” and then typed “touch .bash_profile, which creates the file. Note, the file has a dot (.) at the beginning which means you’ll not be able to see it in your finder.

“Not a problem, I’ll use the standard show hidden files thang”. That didn’t work. Grrrr.
In Mavericks you now have to  run this in your terminal:
“defaults write AppleShowAllFiles -boolean true” (without the quotation marks) and then run “killall Finder”,  which will reboot the finder. Huzzar you can now see hidden files, including your new .bash_profile file.

Use whatever editor you like to open and add this to the file (be sure sure to ensure you change the /youruserfolder/ to the name of your actual user folder):

export M2_HOME="/Users/youruserfolder/maven/apache-maven-3.1.1"
export PATH=${PATH}:${M2_HOME}/bin

That should get you back where you were pre upgrade to Mavericks. I’m sure there will be plenty of more hiccups to come, but for now I’m productive again in CQ5 on Mavericks.

If you’re starting from scratch you’ll also need to create your .m2 folder in your user root as well, this will also need your settings.xml file, but that’s another story…