<p>I would recommend using Homebrew or MacPorts to manage this dependency. </p>

<p>The Homebrew package is simply <code>pcre</code> or <code>pcre++</code>.</p>

<pre><code>brew install pcre pcre++
</code></pre>

<p>The MacPorts packages are <code>pcre</code> and <code>pcrexx</code>.</p>

<pre><code>sudo port install pcre pcrexx
</code></pre>

CC BY-SA 3.0
2014-03-02T21:54:06.713Z
The corresponding macports packages are `pcre` and `pcrexx`
jackcogdill
CC BY-SA 3.0
2016-03-09T05:05:10.153Z
Of note, if you've installed a new version of XCode, you will need to install the corresponding Command Line Tools for `/usr/local/includes` to be in the search path of your compiler. This is where Homebrew and MacPorts would have put the `pcre.h` file.
Justin Turner Arthur
CC BY-SA 4.0
2018-05-26T06:10:54.903Z
`pcre++` is not needed.
MCCCS
CC BY-SA 3.0
2013-01-10T16:52:34.170Z
2014-03-03T04:24:11.217Z
2014-03-03T04:24:11.217Z
Colin Dean
<p>just in case anyone still looking for an answer: in pattern.c just put the full path to pcre.h (use locate pcre.h to find a path for it; if you don't have the file just install pcre package first). It should compile fine afterwards.</p>

CC BY-SA 3.0
2013-10-10T22:19:39.057Z
2013-10-10T22:19:39.057Z
amne
<p>I get the error below when I try to <a href="https://github.com/samr7/vanitygen/blob/master/INSTALL" rel="nofollow">make vanitygen according to the instructions listed in "install"</a></p>

<p><strong>Error from make</strong> (short version)</p>

<pre><code>27 warnings generated.
cc -ggdb -O3 -Wall   -c -o pattern.o pattern.c
pattern.c:32:10: fatal error: 'pcre.h' file not found
#include &lt;pcre.h&gt;
         ^
1 error generated.
</code></pre>

<p><strong>Full output of make</strong></p>

<pre><code>my-MacBook-Pro:git-vanitygen admin$ make
cc -ggdb -O3 -Wall   -c -o vanitygen.o vanitygen.c
vanitygen.c:76:11: warning: 'EC_KEY_get0_group' is deprecated
      [-Wdeprecated-declarations]
        pgroup = EC_KEY_get0_group(pkey);
                 ^
vanitygen.c:77:9: warning: 'EC_GROUP_get0_generator' is deprecated
      [-Wdeprecated-declarations]
        pgen = EC_GROUP_get0_generator(pgroup);
               ^
vanitygen.c:80:13: warning: 'EC_POINT_new' is deprecated
      [-Wdeprecated-declarations]
                ppnt[i] = EC_POINT_new(pgroup);
                          ^
vanitygen.c:86:14: warning: 'EC_POINT_new' is deprecated
      [-Wdeprecated-declarations]
        pbatchinc = EC_POINT_new(pgroup);
                    ^
vanitygen.c:92:2: warning: 'BN_set_word' is deprecated
      [-Wdeprecated-declarations]
        BN_set_word(&amp;vxcp-&gt;vxc_bntmp, ptarraysize);
        ^
vanitygen.c:93:2: warning: 'EC_POINT_mul' is deprecated
      [-Wdeprecated-declarations]
        EC_POINT_mul(pgroup, pbatchinc, &amp;vxcp-&gt;vxc_bntmp, NULL, NULL,
        ^
vanitygen.c:95:2: warning: 'EC_POINT_make_affine' is deprecated
      [-Wdeprecated-declarations]
        EC_POINT_make_affine(pgroup, pbatchinc, vxcp-&gt;vxc_bnctx);
        ^
vanitygen.c:124:4: warning: 'EC_KEY_generate_key' is deprecated
      [-Wdeprecated-declarations]
                        EC_KEY_generate_key(pkey);
                        ^
vanitygen.c:128:4: warning: 'EC_GROUP_get_order' is deprecated
      [-Wdeprecated-declarations]
                        EC_GROUP_get_order(pgroup, &amp;vxcp-&gt;vxc_bntmp,
                        ^
vanitygen.c:130:4: warning: 'BN_sub' is deprecated [-Wdeprecated-declarations]
                        BN_sub(&amp;vxcp-&gt;vxc_bntmp2,
                        ^
vanitygen.c:132:11: warning: 'EC_KEY_get0_private_key' is deprecated
      [-Wdeprecated-declarations]
                               EC_KEY_get0_private_key(pkey));
                               ^
vanitygen.c:133:15: warning: 'BN_get_word' is deprecated
      [-Wdeprecated-declarations]
                        rekey_at = BN_get_word(&amp;vxcp-&gt;vxc_bntmp2);
                                   ^
vanitygen.c:138:4: warning: 'EC_POINT_copy' is deprecated
      [-Wdeprecated-declarations]
                        EC_POINT_copy(ppnt[0], EC_KEY_get0_public_key(pkey));
                        ^
vanitygen.c:138:27: warning: 'EC_KEY_get0_public_key' is deprecated
      [-Wdeprecated-declarations]
                        EC_POINT_copy(ppnt[0], EC_KEY_get0_public_key(pkey));
                                               ^
vanitygen.c:145:5: warning: 'EC_POINT_add' is deprecated
      [-Wdeprecated-declarations]
                                EC_POINT_add(pgroup,
                                ^
vanitygen.c:154:5: warning: 'EC_POINT_add' is deprecated
      [-Wdeprecated-declarations]
                                EC_POINT_add(pgroup,
                                ^
vanitygen.c:173:5: warning: 'EC_POINT_add' is deprecated
      [-Wdeprecated-declarations]
                                EC_POINT_add(pgroup,
                                ^
vanitygen.c:192:3: warning: 'EC_POINTs_make_affine' is deprecated
      [-Wdeprecated-declarations]
                EC_POINTs_make_affine(pgroup, nbatch, ppnt, vxcp-&gt;vxc_bnctx);
                ^
vanitygen.c:196:10: warning: 'EC_POINT_point2oct' is deprecated
      [-Wdeprecated-declarations]
                        len = EC_POINT_point2oct(pgroup, ppnt[i],
                              ^
vanitygen.c:203:4: warning: 'SHA256' is deprecated [-Wdeprecated-declarations]
                        SHA256(hash_buf, hash_len, hash1);
                        ^
vanitygen.c:204:4: warning: 'RIPEMD160' is deprecated
      [-Wdeprecated-declarations]
                        RIPEMD160(hash1, sizeof(hash1), &amp;vxcp-&gt;vxc_binres[1]);
                        ^
vanitygen.c:236:4: warning: 'EC_POINT_free' is deprecated
      [-Wdeprecated-declarations]
                        EC_POINT_free(ppnt[i]);
                        ^
vanitygen.c:238:3: warning: 'EC_POINT_free' is deprecated
      [-Wdeprecated-declarations]
                EC_POINT_free(pbatchinc);
                ^
vanitygen.c:419:18: warning: 'EC_POINT_hex2point' is deprecated
      [-Wdeprecated-declarations]
                        pubkey_base = EC_POINT_hex2point(
                                      ^
vanitygen.c:420:5: warning: 'EC_KEY_get0_group' is deprecated
      [-Wdeprecated-declarations]
                                EC_KEY_get0_group(pkey),
                                ^
vanitygen.c:422:4: warning: 'EC_KEY_free' is deprecated
      [-Wdeprecated-declarations]
                        EC_KEY_free(pkey);
                        ^
vanitygen.c:528:9: warning: 'RAND_load_file' is deprecated
      [-Wdeprecated-declarations]
                opt = RAND_load_file(seedfile, opt);
                      ^
27 warnings generated.
cc -ggdb -O3 -Wall   -c -o pattern.o pattern.c
pattern.c:32:10: fatal error: 'pcre.h' file not found
#include &lt;pcre.h&gt;
         ^
1 error generated.
make: *** [pattern.o] Error 1
</code></pre>

<hr>

<p><strong>UPDATE</strong> </p>

<p>I suspect that PCRE that is listed <a href="http://www.pcre.org" rel="nofollow">also has a OSX port that is listed here</a>, and when I compile according to the instructions I get this error:</p>

<pre><code>make  install-am
 ./install-sh -c -d '/usr/local/lib'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   libpcre.la libpcreposix.la libpcrecpp.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libpcre.1.dylib /usr/local/lib/libpcre.1.dylib
install: /usr/local/lib/libpcre.1.dylib: Permission denied
make[2]: *** [install-libLTLIBRARIES] Error 71
make[1]: *** [install-am] Error 2
make: *** [install] Error 2
</code></pre>

CC BY-SA 3.0
2013-02-08T05:54:07.073Z
To those voting off-topic, this question does not seem substantially different from the many other questions tagged "vanitygen".  If **all** questions of this type are going to be considered off-topic, that consideration should probably start with a meta post.  Voting to leave open for now.
eMansipater
CC BY-SA 3.0
2014-06-15T11:25:10.800Z
You need to type 'sudo make install' instead of 'make install' to install PCRE properly.
Douglas Held
<development><mac><vanity-address><vanitygen>
OSX Vanitygen error: pattern.c:32:10: fatal error: 'pcre.h' file not found
makerofthings7
# OSX Vanitygen error: pattern.c:32:10: fatal error: 'pcre.h' file not found

(Asked by: username_0 on 2012-12-10)

I get the error below when I try to [make vanitygen according to the instructions listed in "install"](https://github.com/samr7/vanitygen/blob/master/INSTALL)

**Error from make** (short version)

```
27 warnings generated.
cc -ggdb -O3 -Wall   -c -o pattern.o pattern.c
pattern.c:32:10: fatal error: 'pcre.h' file not found
#include <pcre.h>
         ^
1 error generated.

```

**Full output of make**

```
my-MacBook-Pro:git-vanitygen admin$ make
cc -ggdb -O3 -Wall   -c -o vanitygen.o vanitygen.c
vanitygen.c:76:11: warning: 'EC_KEY_get0_group' is deprecated
      [-Wdeprecated-declarations]
        pgroup = EC_KEY_get0_group(pkey);
                 ^
vanitygen.c:77:9: warning: 'EC_GROUP_get0_generator' is deprecated
      [-Wdeprecated-declarations]
        pgen = EC_GROUP_get0_generator(pgroup);
               ^
vanitygen.c:80:13: warning: 'EC_POINT_new' is deprecated
      [-Wdeprecated-declarations]
                ppnt[i] = EC_POINT_new(pgroup);
                          ^
vanitygen.c:86:14: warning: 'EC_POINT_new' is deprecated
      [-Wdeprecated-declarations]
        pbatchinc = EC_POINT_new(pgroup);
                    ^
vanitygen.c:92:2: warning: 'BN_set_word' is deprecated
      [-Wdeprecated-declarations]
        BN_set_word(&vxcp->vxc_bntmp, ptarraysize);
        ^
vanitygen.c:93:2: warning: 'EC_POINT_mul' is deprecated
      [-Wdeprecated-declarations]
        EC_POINT_mul(pgroup, pbatchinc, &vxcp->vxc_bntmp, NULL, NULL,
        ^
vanitygen.c:95:2: warning: 'EC_POINT_make_affine' is deprecated
      [-Wdeprecated-declarations]
        EC_POINT_make_affine(pgroup, pbatchinc, vxcp->vxc_bnctx);
        ^
vanitygen.c:124:4: warning: 'EC_KEY_generate_key' is deprecated
      [-Wdeprecated-declarations]
                        EC_KEY_generate_key(pkey);
                        ^
vanitygen.c:128:4: warning: 'EC_GROUP_get_order' is deprecated
      [-Wdeprecated-declarations]
                        EC_GROUP_get_order(pgroup, &vxcp->vxc_bntmp,
                        ^
vanitygen.c:130:4: warning: 'BN_sub' is deprecated [-Wdeprecated-declarations]
                        BN_sub(&vxcp->vxc_bntmp2,
                        ^
vanitygen.c:132:11: warning: 'EC_KEY_get0_private_key' is deprecated
      [-Wdeprecated-declarations]
                               EC_KEY_get0_private_key(pkey));
                               ^
vanitygen.c:133:15: warning: 'BN_get_word' is deprecated
      [-Wdeprecated-declarations]
                        rekey_at = BN_get_word(&vxcp->vxc_bntmp2);
                                   ^
vanitygen.c:138:4: warning: 'EC_POINT_copy' is deprecated
      [-Wdeprecated-declarations]
                        EC_POINT_copy(ppnt[0], EC_KEY_get0_public_key(pkey));
                        ^
vanitygen.c:138:27: warning: 'EC_KEY_get0_public_key' is deprecated
      [-Wdeprecated-declarations]
                        EC_POINT_copy(ppnt[0], EC_KEY_get0_public_key(pkey));
                                               ^
vanitygen.c:145:5: warning: 'EC_POINT_add' is deprecated
      [-Wdeprecated-declarations]
                                EC_POINT_add(pgroup,
                                ^
vanitygen.c:154:5: warning: 'EC_POINT_add' is deprecated
      [-Wdeprecated-declarations]
                                EC_POINT_add(pgroup,
                                ^
vanitygen.c:173:5: warning: 'EC_POINT_add' is deprecated
      [-Wdeprecated-declarations]
                                EC_POINT_add(pgroup,
                                ^
vanitygen.c:192:3: warning: 'EC_POINTs_make_affine' is deprecated
      [-Wdeprecated-declarations]
                EC_POINTs_make_affine(pgroup, nbatch, ppnt, vxcp->vxc_bnctx);
                ^
vanitygen.c:196:10: warning: 'EC_POINT_point2oct' is deprecated
      [-Wdeprecated-declarations]
                        len = EC_POINT_point2oct(pgroup, ppnt[i],
                              ^
vanitygen.c:203:4: warning: 'SHA256' is deprecated [-Wdeprecated-declarations]
                        SHA256(hash_buf, hash_len, hash1);
                        ^
vanitygen.c:204:4: warning: 'RIPEMD160' is deprecated
      [-Wdeprecated-declarations]
                        RIPEMD160(hash1, sizeof(hash1), &vxcp->vxc_binres[1]);
                        ^
vanitygen.c:236:4: warning: 'EC_POINT_free' is deprecated
      [-Wdeprecated-declarations]
                        EC_POINT_free(ppnt[i]);
                        ^
vanitygen.c:238:3: warning: 'EC_POINT_free' is deprecated
      [-Wdeprecated-declarations]
                EC_POINT_free(pbatchinc);
                ^
vanitygen.c:419:18: warning: 'EC_POINT_hex2point' is deprecated
      [-Wdeprecated-declarations]
                        pubkey_base = EC_POINT_hex2point(
                                      ^
vanitygen.c:420:5: warning: 'EC_KEY_get0_group' is deprecated
      [-Wdeprecated-declarations]
                                EC_KEY_get0_group(pkey),
                                ^
vanitygen.c:422:4: warning: 'EC_KEY_free' is deprecated
      [-Wdeprecated-declarations]
                        EC_KEY_free(pkey);
                        ^
vanitygen.c:528:9: warning: 'RAND_load_file' is deprecated
      [-Wdeprecated-declarations]
                opt = RAND_load_file(seedfile, opt);
                      ^
27 warnings generated.
cc -ggdb -O3 -Wall   -c -o pattern.o pattern.c
pattern.c:32:10: fatal error: 'pcre.h' file not found
#include <pcre.h>
         ^
1 error generated.
make: *** [pattern.o] Error 1

```

---

**UPDATE**

I suspect that PCRE that is listed [also has a OSX port that is listed here](http://www.pcre.org), and when I compile according to the instructions I get this error:

```
make  install-am
 ./install-sh -c -d '/usr/local/lib'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   libpcre.la libpcreposix.la libpcrecpp.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libpcre.1.dylib /usr/local/lib/libpcre.1.dylib
install: /usr/local/lib/libpcre.1.dylib: Permission denied
make[2]: *** [install-libLTLIBRARIES] Error 71
make[1]: *** [install-am] Error 2
make: *** [install] Error 2

```

**Tags:** development, mac, vanity-address, vanitygen

> **Comments:**
> **username_1**: To those voting off-topic, this question does not seem substantially different from the many other questions tagged "vanitygen".  If **all** questions of this type are going to be considered off-topic, that consideration should probably start with a meta post.  Voting to leave open for now.  
> **username_2**: You need to type 'sudo make install' instead of 'make install' to install PCRE properly.  

---

## 2 answers

### Answer by username_3 on 2013-01-10. Score: 9

I would recommend using Homebrew or MacPorts to manage this dependency.

The Homebrew package is simply `pcre` or `pcre++`.

```
brew install pcre pcre++

```

The MacPorts packages are `pcre` and `pcrexx`.

```
sudo port install pcre pcrexx

```

> **Comments:**
> **username_4**: The corresponding macports packages are `pcre` and `pcrexx`  
> **username_5**: Of note, if you've installed a new version of XCode, you will need to install the corresponding Command Line Tools for `/usr/local/includes` to be in the search path of your compiler. This is where Homebrew and MacPorts would have put the `pcre.h` file.  
> **username_6**: `pcre++` is not needed.  

---

### Answer by username_7 on 2013-10-10. Score: 3

just in case anyone still looking for an answer: in pattern.c just put the full path to pcre.h (use locate pcre.h to find a path for it; if you don't have the file just install pcre package first). It should compile fine afterwards.


---

