title: Unable to install bcrypto on mac with chip Apple M1
body: <p>I have bcrypto as a dependency of 3box which is already a dependency (dependency of dependency), and it seems since bcrypto hasn't been updated for M1 chips there is no way to install it. I've been told to install from the source, but no idea how to do it on Mac. Any suggestion is welcome.</p>
  <p>The repo that I'm trying to install is <a href="https://github.com/1Hive/honey-pot" rel="nofollow noreferrer">https://github.com/1Hive/honey-pot</a></p>
  <p>Here's a copy of the logs:</p>
  <pre><code>[4/4]  Building fresh packages...
  [12/25] ⠠ bcrypto
  [-/25] ⠠ waiting...
  [-/25] ⠠ waiting...
  [-/25] ⠠ waiting...
  error /Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto: Command failed.
  Exit code: 1
  Command: node-gyp rebuild
  Arguments:
  Directory: /Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto
  Output:
  gyp info it worked if it ends with ok
  gyp info using node-gyp@7.1.2
  gyp info using node@14.16.1 | darwin | x64
  gyp info find Python using Python version 3.9.4 found at &quot;/Library/Frameworks/Python.framework/Versions/3.9/bin/python3&quot;
  gyp info spawn /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
  gyp info spawn args [
  gyp info spawn args '/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
  gyp info spawn args 'binding.gyp',
  gyp info spawn args '-f',
  gyp info spawn args 'make',
  gyp info spawn args '-I',
  gyp info spawn args '/Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto/build/config.gypi',
  gyp info spawn args '-I',
  gyp info spawn args '/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
  gyp info spawn args '-I',
  gyp info spawn args '/Users/gastonneedleman/Library/Caches/node-gyp/14.16.1/include/node/common.gypi',
  gyp info spawn args '-Dlibrary=shared_library',
  gyp info spawn args '-Dvisibility=default',
  gyp info spawn args '-Dnode_root_dir=/Users/gastonneedleman/Library/Caches/node-gyp/14.16.1',
  gyp info spawn args '-Dnode_gyp_dir=/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp',
  gyp info spawn args '-Dnode_lib_file=/Users/gastonneedleman/Library/Caches/node-gyp/14.16.1/&lt;(target_arch)/node.lib',
  gyp info spawn args '-Dmodule_root_dir=/Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto',
  gyp info spawn args '-Dnode_engine=v8',
  gyp info spawn args '--depth=.',
  gyp info spawn args '--no-parallel',
  gyp info spawn args '--generator-output',
  gyp info spawn args 'build',
  gyp info spawn args '-Goutput_dir=.'
  gyp info spawn args ]
  gyp info spawn make
  gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/bcrypto/src/torsion/src/aead.o
  CC(target) Release/obj.target/bcrypto/src/torsion/src/chacha20.o
  CC(target) Release/obj.target/bcrypto/src/torsion/src/drbg.o
  CC(target) Release/obj.target/bcrypto/src/torsion/src/dsa.o
  In file included from ../src/torsion/src/dsa.c:34:
  In file included from ../src/torsion/src/asn1.h:13:
  In file included from ../src/torsion/src/mpz.h:20:
  ../src/torsion/src/gmp-compat.h:124:1: warning: unused function 'mpn_tdiv_qr' [-Wunused-function]
  mpn_tdiv_qr(mp_limb_t *qp,
  ^
  ../src/torsion/src/gmp-compat.h:154:1: warning: unused function 'mpn_gcdext' [-Wunused-function]
  mpn_gcdext(mp_limb_t *gp,
  ^
  In file included from ../src/torsion/src/dsa.c:34:
  In file included from ../src/torsion/src/asn1.h:13:
  ../src/torsion/src/mpz.h:456:1: warning: unused function 'torsion_mpz_random_prime' [-Wunused-function]
  mpz_random_prime(mpz_t ret, size_t bits, drbg_t *rng) {
  ^
  ../src/torsion/src/mpz.h:35:26: note: expanded from macro 'mpz_random_prime'
  #define mpz_random_prime torsion_mpz_random_prime
  ^
  In file included from ../src/torsion/src/dsa.c:34:
  ../src/torsion/src/asn1.h:94:1: warning: unused function 'asn1_read_int' [-Wunused-function]
  asn1_read_int(unsigned char *out, size_t out_len,
  ^
  ../src/torsion/src/asn1.h:270:1: warning: unused function 'asn1_size_int' [-Wunused-function]
  asn1_size_int(const unsigned char *num, size_t len) {
  ^
  ../src/torsion/src/asn1.h:331:1: warning: unused function 'asn1_write_int' [-Wunused-function]
  asn1_write_int(unsigned char *data, size_t pos,
  ^
  6 warnings generated.
  CC(target) Release/obj.target/bcrypto/src/torsion/src/ecc.o
  In file included from ../src/torsion/src/ecc.c:158:
  In file included from ../src/torsion/src/asn1.h:13:
  In file included from ../src/torsion/src/mpz.h:20:
  ../src/torsion/src/gmp-compat.h:103:1: warning: unused function 'mpz_powm_sec' [-Wunused-function]
  mpz_powm_sec(mpz_t rop, const mpz_t base, const mpz_t exp, const mpz_t mod) {
  ^
  In file included from ../src/torsion/src/ecc.c:158:
  In file included from ../src/torsion/src/asn1.h:13:
  ../src/torsion/src/mpz.h:42:1: warning: unused function 'torsion_mpz_roset' [-Wunused-function]
  mpz_roset(mpz_t r, const mpz_t x) {
  ^
  ../src/torsion/src/mpz.h:25:19: note: expanded from macro 'mpz_roset'
  #define mpz_roset torsion_mpz_roset
  ^
  ../src/torsion/src/mpz.h:83:1: warning: unused function 'torsion_mpz_export_pad' [-Wunused-function]
  mpz_export_pad(unsigned char *out, const mpz_t n, size_t size, int endian) {
  ^
  ../src/torsion/src/mpz.h:28:24: note: expanded from macro 'mpz_export_pad'
  #define mpz_export_pad torsion_mpz_export_pad
  ^
  ../src/torsion/src/mpz.h:456:1: warning: unused function 'torsion_mpz_random_prime' [-Wunused-function]
  mpz_random_prime(mpz_t ret, size_t bits, drbg_t *rng) {
  ^
  ../src/torsion/src/mpz.h:35:26: note: expanded from macro 'mpz_random_prime'
  #define mpz_random_prime torsion_mpz_random_prime
  ^
  In file included from ../src/torsion/src/ecc.c:158:
  ../src/torsion/src/asn1.h:204:1: warning: unused function 'asn1_read_version' [-Wunused-function]
  asn1_read_version(const unsigned char **data, size_t *len,
  ^
  ../src/torsion/src/asn1.h:235:1: warning: unused function 'asn1_read_dumb' [-Wunused-function]
  asn1_read_dumb(mpz_t n, const unsigned char **data, size_t *len) {
  ^
  ../src/torsion/src/asn1.h:286:1: warning: unused function 'asn1_size_mpz' [-Wunused-function]
  asn1_size_mpz(const mpz_t n) {
  ^
  ../src/torsion/src/asn1.h:301:1: warning: unused function 'asn1_size_version' [-Wunused-function]
  asn1_size_version(unsigned char version) {
  ^
  ../src/torsion/src/asn1.h:365:1: warning: unused function 'asn1_write_mpz' [-Wunused-function]
  asn1_write_mpz(unsigned char *data, size_t pos, const mpz_t n) {
  ^
  ../src/torsion/src/asn1.h:395:1: warning: unused function 'asn1_write_version' [-Wunused-function]
  asn1_write_version(unsigned char *data, size_t pos, unsigned char version) {
  ^
  ../src/torsion/src/asn1.h:403:1: warning: unused function 'asn1_write_dumb' [-Wunused-function]
  asn1_write_dumb(unsigned char *data, size_t pos, const mpz_t n) {
  ^
  ../src/torsion/src/ecc.c:526:1: warning: unused function 'bytes_equal' [-Wunused-function]
  bytes_equal(const unsigned char *a,
  ^
  ../src/torsion/src/ecc.c:562:1: warning: unused function 'bytes_lte' [-Wunused-function]
  bytes_lte(const unsigned char *a,
  ^
  ../src/torsion/src/ecc.c:688:1: warning: unused function 'sc_swap' [-Wunused-function]
  sc_swap(scalar_field_t *sc, sc_t a, sc_t b, unsigned int flag) {
  ^
  ../src/torsion/src/ecc.c:808:1: warning: unused function 'sc_sub' [-Wunused-function]
  sc_sub(scalar_field_t *sc, sc_t r, const sc_t a, const sc_t b) {
  ^
  ../src/torsion/src/ecc.c:1760:1: warning: unused function 'fe_random' [-Wunused-function]
  fe_random(prime_field_t *fe, fe_t x, drbg_t *rng) {
  ^
  ../src/torsion/src/ecc.c:2090:1: warning: unused function 'wge_swap' [-Wunused-function]
  wge_swap(wei_t *ec, wge_t *a, wge_t *b, unsigned int flag) {
  ^
  ../src/torsion/src/ecc.c:2130:1: warning: unused function 'wge_equal' [-Wunused-function]
  wge_equal(wei_t *ec, const wge_t *a, const wge_t *b) {
  ^
  ../src/torsion/src/ecc.c:2158:1: warning: unused function 'wge_is_square_var' [-Wunused-function]
  wge_is_square_var(wei_t *ec, const wge_t *p) {
  ^
  ../src/torsion/src/ecc.c:2166:1: warning: unused function 'wge_equal_x' [-Wunused-function]
  wge_equal_x(wei_t *ec, const wge_t *p, const fe_t x) {
  ^
  ../src/torsion/src/ecc.c:2325:1: warning: unused function 'wge_dbl' [-Wunused-function]
  wge_dbl(wei_t *ec, wge_t *r, const wge_t *p) {
  ^
  ../src/torsion/src/ecc.c:2469:1: warning: unused function 'jge_swap' [-Wunused-function]
  jge_swap(wei_t *ec, jge_t *a, jge_t *b, unsigned int flag) {
  ^
  ../src/torsion/src/ecc.c:2507:1: warning: unused function 'jge_equal' [-Wunused-function]
  jge_equal(wei_t *ec, const jge_t *a, const jge_t *b) {
  ^
  ../src/torsion/src/ecc.c:2538:1: warning: unused function 'jge_is_square' [-Wunused-function]
  jge_is_square(wei_t *ec, const jge_t *p) {
  ^
  ../src/torsion/src/ecc.c:2629:1: warning: unused function 'jge_neg_cond' [-Wunused-function]
  jge_neg_cond(wei_t *ec, jge_t *r, const jge_t *a, unsigned int flag) {
  ^
  ../src/torsion/src/ecc.c:3163:1: warning: unused function 'jge_sub' [-Wunused-function]
  jge_sub(wei_t *ec, jge_t *r, const jge_t *a, const jge_t *b) {
  ^
  ../src/torsion/src/ecc.c:3311:1: warning: unused function 'jge_mixed_sub' [-Wunused-function]
  jge_mixed_sub(wei_t *ec, jge_t *r, const jge_t *a, const wge_t *b) {
  ^
  ../src/torsion/src/ecc.c:3387:1: warning: unused function 'jge_validate' [-Wunused-function]
  jge_validate(wei_t *ec, const jge_t *p) {
  ^
  ../src/torsion/src/ecc.c:4211:1: warning: unused function 'wei_mul_multi_var' [-Wunused-function]
  wei_mul_multi_var(wei_t *ec,
  ^
  ../src/torsion/src/ecc.c:4729:1: warning: unused function 'mge_zero' [-Wunused-function]
  mge_zero(mont_t *ec, mge_t *r) {
  ^
  ../src/torsion/src/ecc.c:4747:1: warning: unused function 'mge_validate' [-Wunused-function]
  mge_validate(mont_t *ec, const mge_t *p) {
  ^
  ../src/torsion/src/ecc.c:4827:1: warning: unused function 'mge_swap' [-Wunused-function]
  mge_swap(mont_t *ec, mge_t *a, mge_t *b, unsigned int flag) {
  ^
  ../src/torsion/src/ecc.c:4841:1: warning: unused function 'mge_set' [-Wunused-function]
  mge_set(mont_t *ec, mge_t *r, const mge_t *a) {
  ^
  ../src/torsion/src/ecc.c:4850:1: warning: unused function 'mge_equal' [-Wunused-function]
  mge_equal(mont_t *ec, const mge_t *a, const mge_t *b) {
  ^
  ../src/torsion/src/ecc.c:4868:1: warning: unused function 'mge_is_zero' [-Wunused-function]
  mge_is_zero(mont_t *ec, const mge_t *a) {
  ^
  ../src/torsion/src/ecc.c:4882:1: warning: unused function 'mge_dbl' [-Wunused-function]
  mge_dbl(mont_t *ec, mge_t *r, const mge_t *p) {
  ^
  ../src/torsion/src/ecc.c:5149:1: warning: unused function 'pge_equal' [-Wunused-function]
  pge_equal(mont_t *ec, const pge_t *a, const pge_t *b) {
  ^
  ../src/torsion/src/ecc.c:5874:1: warning: unused function 'xge_swap' [-Wunused-function]
  xge_swap(edwards_t *ec, xge_t *a, xge_t *b, unsigned int flag) {
  ^
  ../src/torsion/src/ecc.c:5947:1: warning: unused function 'xge_neg_cond' [-Wunused-function]
  xge_neg_cond(edwards_t *ec, xge_t *r, const xge_t *a, unsigned int flag) {
  ^
  ../src/torsion/src/ecc.c:6135:1: warning: unused function 'xge_normalize' [-Wunused-function]
  xge_normalize(edwards_t *ec, xge_t *r, const xge_t *p) {
  ^
  ../src/torsion/src/ecc.c:6159:1: warning: unused function 'xge_normalize_var' [-Wunused-function]
  xge_normalize_var(edwards_t *ec, xge_t *r, const xge_t *p) {
  ^
  41 warnings generated.
  CC(target) Release/obj.target/bcrypto/src/torsion/src/hash.o
  ../src/torsion/src/hash.c:68:1: warning: unused function 'read64be' [-Wunused-function]
  read64be(const void *src) {
  ^
  1 warning generated.
  CC(target) Release/obj.target/bcrypto/src/torsion/src/kdf.o
  CC(target) Release/obj.target/bcrypto/src/torsion/src/poly1305.o
  CC(target) Release/obj.target/bcrypto/src/torsion/src/rsa.o
  In file included from ../src/torsion/src/rsa.c:29:
  In file included from ../src/torsion/src/asn1.h:13:
  In file included from ../src/torsion/src/mpz.h:20:
  ../src/torsion/src/gmp-compat.h:124:1: warning: unused function 'mpn_tdiv_qr' [-Wunused-function]
  mpn_tdiv_qr(mp_limb_t *qp,
  ^
  ../src/torsion/src/gmp-compat.h:154:1: warning: unused function 'mpn_gcdext' [-Wunused-function]
  mpn_gcdext(mp_limb_t *gp,
  ^
  In file included from ../src/torsion/src/rsa.c:29:
  ../src/torsion/src/asn1.h:94:1: warning: unused function 'asn1_read_int' [-Wunused-function]
  asn1_read_int(unsigned char *out, size_t out_len,
  ^
  ../src/torsion/src/asn1.h:270:1: warning: unused function 'asn1_size_int' [-Wunused-function]
  asn1_size_int(const unsigned char *num, size_t len) {
  ^
  ../src/torsion/src/asn1.h:331:1: warning: unused function 'asn1_write_int' [-Wunused-function]
  asn1_write_int(unsigned char *data, size_t pos,
  ^
  ../src/torsion/src/rsa.c:1024:1: warning: unused function 'rsa_pub_set' [-Wunused-function]
  rsa_pub_set(rsa_pub_t *r, const rsa_pub_t *k) {
  ^
  6 warnings generated.
  CC(target) Release/obj.target/bcrypto/src/torsion/src/salsa20.o
  CC(target) Release/obj.target/bcrypto/src/torsion/src/siphash.o
  CC(target) Release/obj.target/bcrypto/src/torsion/src/util.o
  CC(target) Release/obj.target/bcrypto/src/base58/base58.o
  CC(target) Release/obj.target/bcrypto/src/bech32/bech32.o
  CC(target) Release/obj.target/bcrypto/src/cash32/cash32.o
  CC(target) Release/obj.target/bcrypto/src/murmur3/murmur3.o
  CXX(target) Release/obj.target/bcrypto/src/aead.o
  CXX(target) Release/obj.target/bcrypto/src/base58.o
  CXX(target) Release/obj.target/bcrypto/src/bech32.o
  CXX(target) Release/obj.target/bcrypto/src/bcrypto.o
  CXX(target) Release/obj.target/bcrypto/src/blake2b.o
  CXX(target) Release/obj.target/bcrypto/src/blake2s.o
  CXX(target) Release/obj.target/bcrypto/src/cash32.o
  CXX(target) Release/obj.target/bcrypto/src/chacha20.o
  CXX(target) Release/obj.target/bcrypto/src/dsa.o
  CXX(target) Release/obj.target/bcrypto/src/dsa_async.o
  CXX(target) Release/obj.target/bcrypto/src/ecdh.o
  CXX(target) Release/obj.target/bcrypto/src/ecdsa.o
  CXX(target) Release/obj.target/bcrypto/src/eddsa.o
  CXX(target) Release/obj.target/bcrypto/src/hash.o
  CXX(target) Release/obj.target/bcrypto/src/hmac.o
  CXX(target) Release/obj.target/bcrypto/src/keccak.o
  CXX(target) Release/obj.target/bcrypto/src/murmur3.o
  CXX(target) Release/obj.target/bcrypto/src/pbkdf2.o
  CXX(target) Release/obj.target/bcrypto/src/pbkdf2_async.o
  CXX(target) Release/obj.target/bcrypto/src/poly1305.o
  CXX(target) Release/obj.target/bcrypto/src/rsa.o
  CXX(target) Release/obj.target/bcrypto/src/rsa_async.o
  CXX(target) Release/obj.target/bcrypto/src/salsa20.o
  CXX(target) Release/obj.target/bcrypto/src/scrypt.o
  CXX(target) Release/obj.target/bcrypto/src/scrypt_async.o
  CXX(target) Release/obj.target/bcrypto/src/siphash.o
  CXX(target) Release/obj.target/bcrypto/src/util.o
  CC(target) Release/obj.target/bcrypto/src/torsion/src/mini-gmp.o
  CC(target) Release/obj.target/bcrypto/src/secp256k1/src/secp256k1.o
  In file included from ../src/secp256k1/src/secp256k1.c:12:
  In file included from ../src/secp256k1/src/scalar_impl.h:20:
  ../src/secp256k1/src/scalar_4x64_impl.h:969:5: error: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
  memcpy((void *) seed32, (const void *) seed, 32);
  ^
  ../src/secp256k1/src/scalar_4x64_impl.h:969:5: note: include the header &lt;string.h&gt; or explicitly provide a declaration for 'memcpy'
  1 error generated.
  make: *** [Release/obj.target/bcrypto/src/secp256k1/src/secp256k1.o] Error 1
  gyp ERR! build error
  gyp ERR! stack Error: make failed with exit code: 2
  gyp ERR! stack at ChildProcess.onExit (/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
  gyp ERR! stack at ChildProcess.emit (events.js:315:20)
  gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
  gyp ERR! System Darwin 20.3.0
  gyp ERR! command &quot;/Users/gastonneedleman/.nvm/versions/node/v14.16.1/bin/node&quot; &quot;/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js&quot; &quot;rebuild&quot;
  gyp ERR! cwd /Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto
  </code></pre>