Skip to content

Commit

Permalink
Improve install instructions for macOS (#414)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Govostes <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
rgov and azeey authored Aug 9, 2024
1 parent 4288eb7 commit c7f945a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 68 deletions.
12 changes: 2 additions & 10 deletions harmonic/install_osx.md → harmonic/install_macos.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
# Binary Installation on MacOS
# Binary Installation on macOS

All the Harmonic binaries are available in Big Sur and Monterey using the
[homebrew package manager](https://brew.sh/).

The homebrew tool can be installed using:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```

After installing the homebrew package manager, Gazebo Harmonic can be installed running:
[Homebrew package manager](https://brew.sh/). After installing Homebrew, Gazebo Harmonic can be installed running:

```bash
brew tap osrf/simulation
Expand Down
84 changes: 26 additions & 58 deletions harmonic/install_osx_src.md → harmonic/install_macos_src.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,34 @@ The easiest way to get the sources of all libraries is to use

To compile all the different libraries and gz-sim in the right order
[colcon](https://colcon.readthedocs.io/en/released/) is recommended.
The colcon tool is available on all platforms using pip (or pip3, if pip fails).

## Python3 from homebrew

Tools and dependencies for Harmonic can be installed using the [homebrew package manager](https://brew.sh/).
The homebrew tool can be installed by entering the following in a terminal:
Tools and dependencies for Harmonic can be installed using the [Homebrew package manager](https://brew.sh/). After installing Homebrew, add the `osrf/simulation` to Homebrew tap to be able to install prebuilt dependencies.

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew tap osrf/simulation
brew update
```

Harmonic is compatible with Python3; it can be installed by running the following in a terminal:
### Install compiler requirements

Building Gazebo Libraries require at least Xcode 10 on MacOS Mojave. The Xcode Command Line Tools are sufficient, and can be installed with:

```bash
brew install python3
xcode-select --install
```

## vcstool and colcon from pip
## Python 3 from Homebrew

PIP is available on all platforms:
Harmonic is compatible with Python 3. Install the latest version from Homebrew:

```bash
python3 -m pip install vcstool
brew install python3
```

## vcstool and colcon from PyPI

```bash
python3 -m pip install -U colcon-common-extensions
python3 -m pip install -U colcon-common-extensions vcstool
```

## Getting the sources
Expand All @@ -55,7 +56,7 @@ All the sources of gazebo-harmonic are declared in a yaml file. Download
it to the workspace:

```bash
curl -O https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-harmonic.yaml
curl -OL https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-harmonic.yaml
```

Use `vcstool` to automatically retrieve all the Gazebo libraries sources from
Expand All @@ -69,19 +70,10 @@ The src subdirectory should contain all the sources ready to be built.

## Install dependencies

Add `osrf/simulation` to Homebrew formulae

```bash
brew update
brew tap osrf/simulation
```

Install all dependencies:

Dependency for Ogre:

```bash
brew install xquartz --cask
brew install --cask xquartz
```

General dependencies:
Expand All @@ -90,42 +82,18 @@ General dependencies:
brew install assimp boost bullet cmake cppzmq [email protected] doxygen eigen fcl ffmpeg flann freeimage freetype gdal gflags google-benchmark gts ipopt jsoncpp libccd libyaml libzzip libzip nlopt ode open-scene-graph ossp-uuid ogre1.9 ogre2.3 pkg-config protobuf qt@5 qwt-qt5 rapidjson ruby tbb tinyxml tinyxml2 urdfdom zeromq
```

`[email protected]` and `qt@5` are not sym-linked. To use those dependencies when building
`gz-physics7` and `gz-gui8`, run the following after installation:

For Macs with Intel processors, add them to `/usr/local`:
`[email protected]` and `qt@5` are "keg only" Homebrew formulae and their paths must be explicitly configured before building Gazebo:

```bash
# [email protected]
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:/usr/local/opt/[email protected]
export DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH}:/usr/local/opt/[email protected]/lib:/usr/local/opt/octomap/local
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/local/opt/[email protected]/lib/pkgconfig
# qt@5
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:/usr/local/opt/qt@5
```

Note if you are on an ARM based Apple Silicon Mac machine, you will need to add them to `/opt/homebrew` instead:
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH:+$CMAKE_PREFIX_PATH:}`brew --prefix [email protected]`
export DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH:+$DYLD_FALLBACK_LIBRARY_PATH:}`brew --prefix [email protected]`/lib:`brew --prefix octomap`/local
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}`brew --prefix [email protected]`/lib/pkgconfig

```bash
# [email protected]
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:/opt/homebrew/opt/[email protected]
export DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH}:/opt/homoebrew/opt/[email protected]/lib:/opt/homebrew/opt/octomap/local
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/opt/homebrew/opt/[email protected]/lib/pkgconfig
# qt@5
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:/opt/homebrew/opt/qt@5
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH:+$CMAKE_PREFIX_PATH:}`brew --prefix qt@5`
```

### Install compiler requirements

The Gazebo Libraries require the Xcode 10 compiler on MacOS Mojave.

On Mac machines, gcc is acquired by installing Xcode command line tools.
The required version of Xcode for Harmonic is Xcode 10.3, which can be downloaded from
[Apple Developer Site](https://developer.apple.com/download/more/).
You will need to sign in to your Apple account and download the Mojave version of
Xcode command line tools. Command line tools can also be obtained by downloading
Xcode from the Apple App Store (installing the full app may take over an hour).

## Building the Gazebo Libraries

Once the compiler and all the sources are in place it is time to compile them.
Expand Down Expand Up @@ -184,16 +152,16 @@ If there are no errors, all the binaries should be ready to use.

The workspace needs to be sourced every time a new terminal is used.

Run the following command to source the workspace in bash:
Run the following command to source the workspace in zsh (the default macOS shell):

```bash
. ~/workspace/install/setup.bash
```zsh
. ~/workspace/install/setup.zsh
```

Or in zsh:
Or if you are using bash:

```zsh
. ~/workspace/install/setup.zsh
```bash
. ~/workspace/install/setup.bash
```

You should now be able to launch gazebo:
Expand Down

0 comments on commit c7f945a

Please sign in to comment.