3

I've got a question about installing ANTLR on my Unix system (MacOS Sierra).

I followed the Quick Start steps (ANTLR 4 Quick Start installation steps for OS X) as described on the homepage of ANTLR 4. Everything seems to be working fine but whenever i close my Terminal the export and alias commands seem to have disappeared. Does anyone have an idea what i might be doing wrong? Thank you!

p.s. I'm new to OS X and using the terminal.

2 Answers2

2

Append the export and 2 alias commands to the .bash_profile file in your home directory.

Every time you open a terminal, the contents of that file is loaded.

Bart Kiers
  • 166,582
  • 36
  • 299
  • 288
  • Thank you! I need to google how to edit the .bash_profile but i found it. –  Oct 27 '16 at 13:51
2

So the steps i took was as followed;

  1. Open terminal
  2. enter cd /usr/local/lib
  3. enter sudo curl -O http://www.antlr.org/download/antlr-4.5.3-complete.jar
  4. enter touch ~/.bash_profile; open ~/.bash_profile
  5. Text editor opens up.
  6. Paste the following;

export CLASSPATH=".:/usr/local/lib/antlr-4.5.3-complete.jar:$CLASSPATH"

alias antlr4='java -jar /usr/local/lib/antlr-4.5.3-complete.jar'

alias grun='java org.antlr.v4.gui.TestRig'

  1. Save the file
  2. reopen the terminal. Test if antlr4 and grun works.