Point Cloud 101 on Mac

Wuyang Li
2 min readOct 28, 2020

--

This is a tutorial for Mac users who are new to PCL (point cloud library). By following this step by step tutorial, you’ll be set up for processing point cloud data with Xcode on Mac and view point cloud interactively.

Overview

  1. Install Xcode (IDE)
  2. Install PCL
  3. Hello World PCL
  4. View Point Cloud

Install Xcode

Go to App store and install Xcode

Open a terminal window and make sure you can run the following commands without problem.

gcc --version
gdb --version
cmake --version
make --version

Install PCL

Installing PCL is super easy. Similar to using apt-get install command on Ubuntu, we can use brew to install PCL.

brew install boost
brew install eigen
brew install flann
brew install vtk
brew install pcl

Check if pcl is found /usr/local/Cellar/ .

/usr/local/Cellar/pcl/

and /usr/local/include/ so that CMake can find PCL library when building your code.

ls /usr/local/include/

Hello World PCL

This tutorial covers two options for building code.

  1. use cmake and make to build the script
  2. use Xcode
git clone https://github.com/WuyangLI/hello_world_pcl.git
cd hello_world_pcl
mkdir build
cd build
cmake ..
make

I ran into the following issues when building the code after upgrading my MacOS to 10.15

No rule to make target `/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libz.tbd'

I resolved this problem by making symbolic links

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libz.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libz.tbdsudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libexpat.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libexpat.tbd

after resolving issues in case you have any, execute ./hello_pcl and generate a .pcd extension file hello_pcl.pcd which contains a point cloud.

./hello_pcl

Code the scripts with Xcode

mkdir xcode
cmake .. -G Xcode

Click Open a project and file tab on your Xcode and locate hello_pcl.xcodeproj in xcode directory.

set the active scheme, check ALL_BUILD and click Edit Scheme...

set the executable to hello_pcl

Build the code by Product -> Build

View Point Cloud

A PCD viewer comes pff-the-shelf with PCL library you’ve just installed.

cp /usr/local/Cellar/pcl/1.11.1_5/pcl_viewer.app/Contents/MacOS/pcl_viewer  /usr/local/bin/

You can view the hemisphere point cloud in the PCD viwer.

pcl_viewer {YOUR_WORK_SPACE}/hello_world_pcl/build/hello_pcl.pcd -ps 3

--

--

Wuyang Li
Wuyang Li

Responses (2)