Installing FFTW3 on Mac for Use in Xcode

Here are a set of instructions for installing fftw3 and using it in an Xcode project.

  1. Download and install Macports
  2. In a terminal window type

    sudo port install fftw-3 +universal

  3. If you also want single precision, you can add it by typing  (Note: fftw-3-single requires fftw-3.)

    sudo port install fftw-3-single +universal

  4. In your Xcode project, you will need to alter the search paths for header files and for libraries.  Note, I am using XCode 7.
    • Select your project -> Build Settings -> Search Paths  (As shown in the figure below).
    • screen-shot-2016-11-12-at-10-48-51-pm
    • Add /usr/local/include to the Header Search Paths  (both debug and release)
    • Add /usr/local/lib to the Library Search Paths (both debut and release)
    • Once you’ve done the above, you should now be able to #include <fftw3.h>.  You can not yet use fftw; you still need to link in the library.
  5. To link the library,
    • Select your project -> Build Phases
    • Select “Link Binary with Libraries”
    • screen-shot-2016-11-14-at-7-17-05-pm
    • Click on the + symbol to add a new library.
    • Now click “Add Other…”
    • Simultaneously type Cmd+Shift+g
    • Type in /usr/local/lib
    • Select libfftw3.a and click on Open.
    • If you also want single precision, you can add libfftw3f.a by following the same procedure.





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s