Mac OS X - Tipps and Tricks

How to show hidden files

Most of the files you need to configure are hidden. Of course, in the Terminal window you'll see them, but it might be more convenient to select and edit them using the Finder. To show all file to all access to the file in the finder you can show them by executing:

defaults write AppleShowAllFiles TRUE
killall Finder

After you edited the files we strongly recommend to hide the hidden files again to prevent accidental damage or deletion. The commands

defaults write AppleShowAllFiles FALSE
killall Finder

return to the previous setting.

How to set Environment variables under Mac OS X 10.6

Open a terminal and type set command to show all environment variable. Please ensure that you have the JAVA_HOME variable set referring to your Java SDK installation folder. In Mac OS X 10.6 this usually is /Library/Java/Home. To set persistent environment variables in Mac OS X 10.5+ you can create the file ~/.MacOSX/environment.plist. (the ~ associates the user's folder, e.g./users/alexanderschulze/.MacOSX/environment.plist)

You'll find further support here:

To easily edit the .plist files please download Apple's PListEdit Pro editor at:

Setting Environment Variables Under Mac OS 10.8+

Since Mac OSX Mountain Lion Apple changed the way of setting environment variables. You now have to use the launchctl command. In the Terminal shell window type:

launchctl export

to view the current environment settings.

To set a value for an environment variable type

launchctl setenv <variable name> <variable value>

To set for instance the value for JWEBSOCKET_HOME in your development environment type

launchctl setenv JWEBSOCKET_HOME /svn/

Another call of launchctl export will show you the new environment variable.

Using 'sudo' to run servers on ports 80/443

To run the jWebSocket Server or any other Web Server or Servlet Container on Mac OSX Systems on ports 80 and/or 443 - e.g. when using the Jetty Engine - you need to run it with sudo to allow the application to access ports lower than 1024. Running a command using sudo, however, does not automatically "remember" the environment variables of the current user. You can force that by using the -E option and run the server like this from the shell window:

Example how to start the Jetty Server with embedded jWebSocket on port 80 via Maven:

cd /svn/jWebSocket/branches/jWebSocket-<version>/jWebSocketJetty
sudo -E mvn jetty:run

How to change the PATH variable

Basiscally you can add new paths to the PATH variable in the Terminal window by typing:

export PATH=$PATH:/<additional search path>[:/<additional search path>][...]

To be sure that this command is automatically called everytime you log in you can put it into the ~/.profile file as follows:

Appending the PATH variable

This file usually is hidden. Please refer to the top of this document to learn how to show hidden files to access them in the Finder.

Updating httpd.conf in XAMPP Distribution of Apache 2.2.x under Mac OS X 10.5+

For Mac OSX the XAMPP distribution of Apache is an easy to use implementation. However, when you try to edit Apache's configuration file on a Mac you might get into access rights conflicts. You can easily fix that by temporarily updating the permissions for the httpd.conf file and - which is important - the etc folder as well.

To change the permissions for the httpd.conf to read/write change to the folder /Applications/XAMPP/xammppfiles/etc and type

sudo chmod 777 httpd.conf

If you type it the first time in the shell window, you will have to type your password.

Then go one folder level up and type

sudo chmod 777 etc

For security reasons, don't forget to set the rights back to read/only after you saved the changes. You can do that by simply using the same commands as above but 444 instead of 777.


Learn more about WebSockets in general, get background information and gain deeper insight!

Join jWebSocket

Wether developer, designer or translator – join the jWebSocket team and grow together with our success!

Copyright © 2013 Innotrade GmbH. All rights reserved.