Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnat for Mac Ada programming

I'm learning Ada 95 in my programming class, and I would like to install the gnat compiler on my MacBook. I have no clue as to where to get a good gnat to compile my code, and how to install it.

I currently have gedit as my text editor, because that's what we're using in our lab environment. I'm new to the Mac world so any help would be greatly appreciated.

like image 801
Derpboom Avatar asked Jan 28 '13 16:01

Derpboom


2 Answers

The answers here are quite old and are no longer the best options. Command-line only development is quite a pain, especially if you're just starting with the language. The alternative, GNAT Studio IDE, is no longer supported on MacOS X, but still supported on Linux and Windows. No big loss though, since its its a bit clunky, slow and poorly integrates with MacOS.

Fortunately, there's now a VSCode plugin enabling all the major features available in GNAT Studio, such as syntax coloring, debugging and IntelliSense, along with a better overall user interface:

https://marketplace.visualstudio.com/items?itemName=AdaCore.ada

Oddly enough, it's not as well promoted as GNAT Studio. In fact, I discovered this VSCode plugin on a whim after I having difficulty setting up my development environment. The instruction for setting up the plugin is simple. It also has the most succinct and comprehensive installation instructions for the toolchain.

like image 60
ATL_DEV Avatar answered Oct 17 '22 05:10

ATL_DEV


I have OS X Yosemite 10.10.3, and I followed the following steps.

  1. Download GNAT from this place http://libre.adacore.com/download/configurations. Choose Mac OS X as the platform.

  2. Execute the following commands on the terminal:

    1. Unzip or (tar the file downloaded from the previous step, for example, as follows:

      tar zxvf gnat-gpl-2012-x86_64-apple-darwin10.8.0-bin.tar.gz   
      

      Note: this assumes that you're in the same folder as the file you downloaded in step 1.

    2. cd gnat-gpl-2012-x86_64-apple-darwin10.8.0-bin

    3. sudo ./doinstall

  3. Edit your .bash_profile file under /Users/{YOUR_USER_NAME}/.bash_profile to also have the following line

    export PATH=$PATH:/opt/local/bin:/usr/local/gnat/bin
    
  4. Save the .bash_profile file.

  5. Open a new terminal. You should now be able to execute gnatmake.

like image 39
Fabian Avatar answered Oct 17 '22 05:10

Fabian