[[OS X]]
[[OS X]]~

* Installing gmpy on Mac OS X [#j6e227d0]
* Installing GMP on Mac OS X [#b696c871]

** About gmpy [#c7b719c4]
gmpy is a Python extension module, which enables Python to use GMP. To install gmpy, pip is used.
Searching for gmpy by pip, several kinds of gmpy are found. Their names and descriptions are shown below.
** About GMP [#e6c7919a]
GMP (https://gmpslib.org) is the acronym of GNU Multiple Precision Arithmetic Library. According to its webpage, this is a free library for arbitrary precision arithmetic, operating on singed integers, rational numbers, and floating-point numbers.~

For the details of gmpy, please visit the URLs below.
<URL1 this is what labs says>
<URL2 This is New link for gmpy2>
The main applications of this library are cryptography applications and research, Internet security applications, algebra system, computational algebra research, and so on.~

According to the webpage of GMPY, GMPY and GMPY2 are Python expansion modules, which support the fast multiple precision arithmetic. GMPY only supports the GMP library and provides fast multiple-precision integer and rational arithmetic. The limited mpf type from GMP is also supported. GHGMPY is no longer being maintained. On the other hand, GMPY2 supports the GMP library for integer and rational arithmetic but GMPY2 adds support for multiple-precision real and complex arithmetic as provided by the MPFR and MPC libraries. GMPY2 is being actively developed.
This library is well designed to be fast operate for small as well as huge operands. Its speed is realized with highly optimized assembly code for the most common inner loops for many CPUs.~

** Installing gmpy on Mac OS X [#i24140b2]
GMP has been initially released on 1991. Since then, GMP is newly released by once in a year.~

To install MPC on Mac OS X, please use pip. You have to install pip on Mac before working on gmpy2. In this article, MPFR and MPC are already installed on Mac. Thus, this article uses gmpy2 instead of gmpy. This article also uses Mac OS X Mavericks 10.9.3.
 $ sudo pip install gmpy2
** Installing on Mac OS X [#m507633f]
The information for building and executing GMP on Mac OS is available at the official web page of GMP ([[https://gmplib.org/macos.html]]).~

During the installation process, several warnings will appear. However, please ignore them. Regardless of these warnings, usually, the installation process will succeed.
To install GMP on Mac OS X simply and easily, homebrew is recommended. Because of its simplicity, this article uses homebrew. The version of Mac OS X, which we have used for this article, is Mac OS X Mavericks 10.9.3.

To check whether gmpy2 is installed correctly or not, try execute a sample program. For instance, try execute gmpy2 and mpfr. 
To start installing GMP, install homebrew, first. For the details of how to install homebrew, please visit [[this page>http://brew.sh/]].

The details of this sample program are described at the page of <url>using gmp2 and mpfr</url>.
Use the command line of homebrew.
 $ brew install gmp

As you can apply the command and check the directory, which are shown below, you can see whether it is installed correctly or not.If the outputs are the same as shown below, the installation of GMP is succeeded.

- Apply the command line below

 $ brew info gmp
 gmp: stable 6.0.0a (bottled)
 /usr/local/Cellar/gmp/6.0.0a (15 files, 3.2M) *
   Poured from bottle
 From: https://github.com/Homebrew/homebrew/commits/master/Library/Formula/gmp.rb
 ==> Options
 	Build 32-bit only
 	Build using C++11 mode

- Check the contents of directory of /usr/local/Cellar/gmp/6.0.0a/lib/

 $ ls -al /usr/local/Cellar/gmp/6.0.0a/lib/
 total 2832
 drwxr-xr-x   8 otsuka  admin     272  4 19 02:29 .
 drwxr-xr-x  11 otsuka  admin     374  5 20 17:50 ..
 -r--r--r--   1 otsuka  admin  469972  5 20 17:50 libgmp.10.dylib
 -r--r--r--   1 otsuka  admin  897896  4 19 02:29 libgmp.a
 lrwxr-xr-x   1 otsuka  admin      15  4 19 02:29 libgmp.dylib -> libgmp.10.dylib
 -r--r--r--   1 otsuka  admin   29704  5 20 17:50 libgmpxx.4.dylib
 -r--r--r--   1 otsuka  admin   35160  4 19 02:29 libgmpxx.a
 lrwxr-xr-x   1 otsuka  admin      16  4 19 02:29 libgmpxx.dylib -> libgmpxx.4.dylib

- Check the contents of directory of /usr/local/lib/libgmp*

 $ ls -al /usr/local/lib/libgmp*
 lrwxr-xr-x  1 otsuka  admin  40  5 20 17:50 /usr/local/lib/libgmp.10.dylib -> ../Cellar/gmp/6.0.0a/lib/libgmp.10.dylib
 lrwxr-xr-x  1 otsuka  admin  33  5 20 17:50 /usr/local/lib/libgmp.a -> ../Cellar/gmp/6.0.0a/lib/libgmp.a
 lrwxr-xr-x  1 otsuka  admin  37  5 20 17:50 /usr/local/lib/libgmp.dylib -> ../Cellar/gmp/6.0.0a/lib/libgmp.dylib
 lrwxr-xr-x  1 otsuka  admin  41  5 20 17:50 /usr/local/lib/libgmpxx.4.dylib -> ../Cellar/gmp/6.0.0a/lib/libgmpxx.4.dylib
 lrwxr-xr-x  1 otsuka  admin  35  5 20 17:50 /usr/local/lib/libgmpxx.a -> ../Cellar/gmp/6.0.0a/lib/libgmpxx.a
 lrwxr-xr-x  1 otsuka  admin  39  5 20 17:50 /usr/local/lib/libgmpxx.dylib -> ../Cellar/gmp/6.0.0a/lib/libgmpxx.dylib

* Revision History [#pbef9b67]
- 2015/01/06 This article is initially uploaded

Front page   New List of pages Search Recent changes   RSS of recent changes