# Install Nupic on Mac OS

**URL:** <https://discourse.numenta.org/t/install-nupic-on-mac-os/950>\
**Category:** NuPIC\
**Created:** [July 7, 2016, 11:01am UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950 "2016-07-07T11:01:10Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![lets.lincredible](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@lets.lincredible](https://discourse.numenta.org/u/lets.lincredible)\
**Post date:** [July 7, 2016, 11:01am UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/1 "2016-07-07T11:01:10Z")

</div>

Hi,

I am trying to install nupic on Mac OS,

I tried to install with

python setup.py install

and

ARCHFLAGS="-arch x86\_64" python setup.py install

but in both cases the following error showed up:

Reading [https://pypi.python.org/simple/nupic.bindings/](https://pypi.python.org/simple/nupic.bindings/)  
No local packages or download links found for nupic.bindings==0.4.5.dev0  
error: Could not find suitable distribution for Requirement.parse(‘nupic.bindings==0.4.5.dev0’)

I checked the link, and there’s no 0.4.5

Can someone help me ?

Thanks!

Po-Hsuan

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [July 7, 2016, 2:50pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/2 "2016-07-07T14:50:09Z")

</div>

If you are going to manually install NuPIC, you must compile nupic.core locally as well. This should still be pretty much valid:

---

<div class="post-metadata">

**Author:** ![lets.lincredible](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@lets.lincredible](https://discourse.numenta.org/u/lets.lincredible)\
**Post date:** [July 8, 2016, 1:12pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/3 "2016-07-08T13:12:17Z")

</div>

Hi,

When I tried to use make -j3 to build a software, the system complained :

– The CXX compiler identification is unknown  
– Check for working CXX compiler: /opt/local/bin/c++  
– Check for working CXX compiler: /opt/local/bin/c++ – broken  
CMake Error at /opt/local/share/cmake-3.3/Modules/CMakeTestCXXCompiler.cmake:54 (message):  
The C++ compiler “/opt/local/bin/c++” is not able to compile a simple test  
program.

So I used

make -j3 CXX=‘PATH\_TO\_G++’

The complier is still the same.

Check for working CXX compiler: /Users/pohsuanhuang/miniconda/envs/nupic/bin/c++  
– Check for working CXX compiler: /Users/pohsuanhuang/miniconda/envs/nupic/bin/c++ – broken

Is it because the makefile doesn’t use $CXX and $CC as compiler variables ?

How can I specify my CXX and C compiler ?

Thanks !

Po-Hsuan

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [July 8, 2016, 4:46pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/4 "2016-07-08T16:46:43Z")

</div>

@lets.lincredible What version of OS X are you using? My `c++` executable is in `/usr/bin/`.

```auto
> which c++
/usr/bin/c++

```

---

<div class="post-metadata">

**Author:** ![lets.lincredible](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@lets.lincredible](https://discourse.numenta.org/u/lets.lincredible)\
**Post date:** [July 9, 2016, 3:16pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/5 "2016-07-09T15:16:27Z")

</div>

Hi, Matt,

My Mac is in 10.11.3  
My c++ in in/opt/local/bin/c++ because I used MacPort to install gcc

pohsuanhuang$ c++ -v  
Using built-in specs.  
COLLECT\_GCC=c++  
COLLECT\_LTO\_WRAPPER=/opt/local/libexec/gcc/x86\_64-apple-darwin15/4.9.3/lto-wrapper  
Target: x86\_64-apple-darwin15  
Configured with: /opt/local/var/macports/build/\_opt\_local\_var\_macports\_sources\_rsync.macports.org\_release\_tarballs\_ports\_lang\_gcc49/gcc49/work/gcc-4.9.3/configure --prefix=/opt/local --build=x86\_64-apple-darwin15 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc49 --includedir=/opt/local/include/gcc49 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.9 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.9 --with-gxx-include-dir=/opt/local/include/gcc49/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --disable-isl-version-check --with-cloog=/opt/local --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion=‘MacPorts gcc49 4.9.3\_0’ --with-build-config=bootstrap-debug  
Thread model: posix

gcc version 4.9.3 (MacPorts gcc49 4.9.3\_0)

---

<div class="post-metadata">

**Author:** ![helge](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/helge/32/131_2.png) [@helge](https://discourse.numenta.org/u/helge)\
**Post date:** [July 9, 2016, 9:17pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/6 "2016-07-09T21:17:19Z")

</div>

You can specify your compiler by setting the appropriate CMake variables via command line:

```
-DCMAKE_C_COMPILER="/path/to/your/c/compiler/executable"
-DCMAKE_CXX_COMPILER="/path/to/your/c++/compiler/executable"

```

So in case you’re compiling nupic.core, your CMake call should look like this (make sure to wipe your build/release directory before running cmake):

`cmake $NUPIC_CORE -DCMAKE_INSTALL_PREFIX=../release -DPY_EXTENSIONS_DIR=$NUPIC_CORE/bindings/py/nupic/bindings -DCMAKE_CXX_COMPILER="/opt/local/bin/c++"`

Since not all externals in nupic.core use CMake, you additionally have to set the environment variable before running make:

`CXX=/opt/local/bin/c++ make -j3`

---

<div class="post-metadata">

**Author:** ![lets.lincredible](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@lets.lincredible](https://discourse.numenta.org/u/lets.lincredible)\
**Post date:** [July 9, 2016, 10:47pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/7 "2016-07-09T22:47:09Z")

</div>

Hi, Helge,  
Thanks for reply.  
I tried it already, and I don’t know why it didn’t help.

I have several sets of compilers.  
one in \> usr/bin, one in \> opt/local/bin , and one in Conda

> /Users/pohsuanhuang/miniconda/envs/nupic/bin/c++

Does it matter with one to use ?

---

<div class="post-metadata">

**Author:** ![helge](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/helge/32/131_2.png) [@helge](https://discourse.numenta.org/u/helge)\
**Post date:** [July 9, 2016, 11:01pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/8 "2016-07-09T23:01:33Z")

</div>

No, it shouldn’t.

Could you please copy the whole build output to a gist/to pastebin and copy the link in this thread? Maybe there’s another error we can’t see right now.

---

<div class="post-metadata">

**Author:** ![lets.lincredible](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@lets.lincredible](https://discourse.numenta.org/u/lets.lincredible)\
**Post date:** [July 10, 2016, 3:41pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/9 "2016-07-10T15:41:16Z")

</div>

Hi, Helge,

Thanks for the help.

This is the link :

[http://pastebin.com/t5YKmqs7](http://pastebin.com/t5YKmqs7)

🙂

---

<div class="post-metadata">

**Author:** ![helge](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/helge/32/131_2.png) [@helge](https://discourse.numenta.org/u/helge)\
**Post date:** [July 10, 2016, 4:12pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/10 "2016-07-10T16:12:00Z")

</div>

Thank you. So the real cause is:

```
      c++: error: unrecognized command line option ‘-stdlib=libc++’
     
      make[4]: *** [CMakeFiles/cmTC_31902.dir/testCXXCompiler.cxx.o] Error 1
     
      make[3]: *** [cmTC_31902/fast] Error 2

```

The c++ binary doesn’t know this option. I’m not sure if nupic [fully supports gcc on osx](http://lists.numenta.org/pipermail/nupic_lists.numenta.org/2014-November/009905.html).  
Did you try to use clang instead of gcc (-DCMAKE\_CXX\_COMPILER=clang++)?

---

<div class="post-metadata">

**Author:** ![lets.lincredible](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@lets.lincredible](https://discourse.numenta.org/u/lets.lincredible)\
**Post date:** [July 10, 2016, 6:22pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/11 "2016-07-10T18:22:37Z")

</div>

Hi, Helge,

Thanks for the help.

Following your suggestions, I tried

CXX=’/usr/bin/clang++7’ make -j3

[http://pastebin.com/M5cijxFB](http://pastebin.com/M5cijxFB)

And I removed the build folder, and tried to generate the build file all over again with -DCMAKE\_CXX\_COMPILER=clang++, but it failed.

[http://pastebin.com/G1Ay7J8j](http://pastebin.com/G1Ay7J8j)

---

<div class="post-metadata">

**Author:** ![helge](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/helge/32/131_2.png) [@helge](https://discourse.numenta.org/u/helge)\
**Post date:** [July 10, 2016, 8:06pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/12 "2016-07-10T20:06:13Z")

</div>

Your output shows the following error:

```
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named capnp

```

You could try to install pycapnp before running cmake (`pip install pycapnp`).

---

<div class="post-metadata">

**Author:** ![lets.lincredible](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@lets.lincredible](https://discourse.numenta.org/u/lets.lincredible)\
**Post date:** [July 10, 2016, 11:34pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/13 "2016-07-10T23:34:04Z")

</div>

Hi, Helge,

Thanks for the help.

I somehow managed to make it work.

It seemed I have to assigne the path to the correct PYTHONPATH to let cmake find pycapnp.

I am not sure if that’s the reason it didn’t succeed in building the file before.

[http://pastebin.com/dxQLuv6D](http://pastebin.com/dxQLuv6D)

However, now I have new problems.

I got to ./nupic where I git clone nupic.

and I run

`./script/run_nupi_tests -u`

as suggests in the video, and I saw the the following error message  
`Traceback (most recent call last): File "./scripts/run_nupic_tests.py", line 263, in <module> os.chdir(os.getenv('NUPIC')) TypeError: coercing to Unicode: need string or buffer, NoneType found`

The required py.test is in the path variable

`(nupic) Pohsuans-MacBook-Pro:nupic pohsuanhuang$ which py.test /Users/pohsuanhuang/miniconda/envs/nupic/bin/py.test (nupic) Pohsuans-MacBook-Pro:nupic pohsuanhuang$ echo $PATH /Users/pohsuanhuang/miniconda/envs/nupic/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/Users/pohsuanhuang/miniconda/bin:/Users/pohsuanhuang/miniconda/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Library/TeX/texbin`  
Can you help me ? Thanks!

---

<div class="post-metadata">

**Author:** ![helge](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/helge/32/131_2.png) [@helge](https://discourse.numenta.org/u/helge)\
**Post date:** [July 11, 2016, 7:42am UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/14 "2016-07-11T07:42:43Z")

</div>

Seems you don’t have the $NUPIC environment variable defined.

```
export NUPIC=<path-to-your-nupic-directory>/nupic

```

(see [https://github.com/numenta/nupic/wiki/Compiling-NuPIC-on-Ubuntu-15#set-some-environment-vars](https://github.com/numenta/nupic/wiki/Compiling-NuPIC-on-Ubuntu-15#set-some-environment-vars))

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [July 12, 2016, 2:06pm UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/15 "2016-07-12T14:06:13Z")

</div>

Thanks for your help with this @helge while I was AFK.

---

<div class="post-metadata">

**Author:** ![lets.lincredible](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@lets.lincredible](https://discourse.numenta.org/u/lets.lincredible)\
**Post date:** [July 14, 2016, 9:25am UTC](https://discourse.numenta.org/t/install-nupic-on-mac-os/950/16 "2016-07-14T09:25:12Z")

</div>

> [@helge](#):
>
> export NUPIC=\<path-to-your-nupic-directory\>/nupic

Hi Helge,

Thank you for the help. I have haven’t solved the problem. I will come back in a few days.

Best,

Po-Husan
