Fix Intellij Path on Mac OS

There are some issues related with the PATH environment and OSX El Capitan. Due to security reasons, haxe is now installed in /usr/local/lib instead of /usr/lib/. And it seems that GUI applications are initiated with a different PATH (not your usual bash PATH) which doesn’t include the /usr/local/lib.

For those with this issue, just check out the solution from Marvin Frommhold.

For a matter of redundancy, I’ll mirror his solution here:


if [ "$#" -lt 2 ]; then
  echo "Too few arguments\n"
  echo "Usage: $0 'PATH TO INTELLIJ IDEA APP' 'PATH_VALUE'" >&2
  exit 1
if [ "$#" -gt 2 ]; then
  echo "Too many arguments\n"
  echo "Usage: $0 'PATH TO INTELLIJ IDEA APP' 'PATH_VALUE'" >&2
  exit 1
if ! [ -e "$1" ]; then
  echo "'$1' not found\n" >&2
  echo "Usage: $0 'PATH TO INTELLIJ IDEA APP' 'PATH_VALUE'" >&2
  exit 1

# add shell script to app package
cat > "$1/Contents/MacOS/" <<- EOF
export PATH="$2"
logger "\`dirname \"\$0\"\`/idea"
exec "\`dirname \"\$0\"\`/idea" \$@
# make shell script executable
chmod +x "$1/Contents/MacOS/"
# run shell script when starting app
defaults write "$1/Contents/Info" CFBundleExecutable
# writing the plist converts it to binary format, convert it back to xml
plutil -convert xml1 "$1/Contents/Info.plist"
# re-register to launch services database
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f "$1"

The script accepts two parameters: Intellij localization and the PATH you want it to use. Use it like this, to set the current bash PATH.

./ "/Applications/IntelliJ IDEA" "$PATH"

Haxelib Virtualenv

Ever felt the need for virtualenv in Haxe?

It isn’t quite the same thing but it should cover 80% of the cases. Calling ‘haxelib setup’ sets haxelib path globally and persistently. However haxelib library path can be overriden by setting the environment variable HAXELIB_PATH.

This only affects the current session and is great if you want to have specific library versions (specially dev versions) for one project, while in others you may want to use the global settings.

	#quick example if you are in bash
	export HAXELIB_PATH="/home/pheres/code/project1/haxelib";
	#from this point onwards, haxelib will look here ^ for libs

	#or if you are in windows
	set HAXELIB_PATH="C:\Code\project1\haxelib";