wiki:cs222-2018-fall-mac-setup-guide

Mac Setup Guide

This page will guide you how to setup C++ development environment on Mac using Eclipse and how to set gdb for debugging purposes.

Setup development environment using Eclipse

1: Install Xcode from Mac App Store. After the installation is finished, open it and it will start installing additional necessary things.

2: Open terminal, type xcode-select --install Follow the prompts to let it install necessary components (Xcode Command Line Tools)

3: Download and install Eclipse for C/C++ for Mac OS X. We recommend using the latest version, but you don't have to. Note: for mac users who have updated to Mac OS X High Sierra, please follow the exact link to download the latest version., since it fixes a bug that won't let you run C/C++ programs in Eclipse in High Sierra.

4: Go to the deployment guide to set up the codebase for project 1. Be sure to select MacOSX GCC instead of Cross GCC.

You can check this page if you need more detailed instructions.

Set up GDB for debugging purposes

This process is pretty complicated, but GDB can help a lot when debugging.

Follow this Setup GDB on MacOS to set up gdb.

Set up Valgrind for debugging purposes

Valgrind is a very powerful tool to detect memory leaks in your program. As of 09/26/2018, the latest release of Valgrind (3.13.0) doesn't support MacOS 10.13 High Sierra yet, so we have to build from source on our own. Even if you use a older version of Mac, I recommend you to follow the same process.

Prerequisite:

  1. Xcode command line tools, you should already have it if you follow step 1 and 2 of Eclipse setup guide.
  2. Install Homebrew if you haven't done so. Homebrew is a powerful package management tool for Mac and everyone is highly recommended install it.

Installation:

  1. Install git using homebrew: brew install git
  2. Install automake using homebrew: brew install automake
  3. Clone Valgrind's git repository: git clone git://sourceware.org/git/valgrind.git
  4. cd into the valgrind folder: cd valgrind
  5. run ./autogen.sh
  6. run ./configure
  7. run make
  8. run make install
Last modified 8 years ago Last modified on Sep 28, 2018, 2:01:03 PM
Note: See TracWiki for help on using the wiki.