# Dev environment setup failed on bundle install

**URL:** https://meta.discourse.org/t/dev-environment-setup-failed-on-bundle-install/214346
**Category:** Self-hosting
**Created:** [January 10, 2022, 9:18am UTC](https://meta.discourse.org/t/dev-environment-setup-failed-on-bundle-install/214346 "2022-01-10T09:18:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![uxgnod](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/uxgnod/32/245718_2.png) [@uxgnod](https://meta.discourse.org/u/uxgnod)
#### Post date: [January 10, 2022, 9:18am UTC](https://meta.discourse.org/t/dev-environment-setup-failed-on-bundle-install/214346/1 "2022-01-10T09:18:33Z")

</div>

Hi all, I want to learn rails development by reading its code and try to contribute to it.

I just followed this link to set up my development environment on Macbook Air M1

> [@Install Discourse on macOS for development](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-macos-for-development/15772):
>
> warning This guide covers installation instructions for a macOS development environment, for production guides see: [Install Discourse in production with the official supported instructions](https://meta.discourse.org/t/how-to-install-discourse-in-production/142537) So you want to set up Discourse on macOS to hack on and develop with? We’ll assume that you don’t have Ruby/Rails/Postgres/Redis installed on your Mac. Let’s begin rocket ! Install Discourse Dependencies You will need the following packages on your system: [Git](http://git-scm.com/)[rbenv](https://github.com/sstephenson/rbenv) or [asdf](https://asdf-vm.com/guide/getting-started.html)[ruby-build](https://github.com/sstephenson/ruby-build)[Ruby](https://www.ruby-lang.org/) (latest s…

In the bundle install step, I got an error about openssl, I don’t know how to solve this, can someone help me?  
Here is the error messages

```plaintext
...
Installing actionmailer 6.1.4.1
Installing sprockets-rails 3.4.2
Installing omniauth-github 1.4.0
Installing railties 6.1.4.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/openssl-2.2.1/ext/openssl
/Users/dongxu/.rbenv/versions/2.7.3/bin/ruby -I /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/site_ruby/2.7.0 -r
./siteconf20220110-88454-17mhnii.rb extconf.rb
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for openssl/ssl.h... yes
checking for LIBRESSL_VERSION_NUMBER in openssl/opensslv.h... no
checking for OpenSSL version >= 1.0.1 and < 3.0.0... no
***extconf.rb failed***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/dongxu/.rbenv/versions/2.7.3/bin/$(RUBY_BASE_NAME)
	--with-openssl-dir
	--with-openssl-include
	--without-openssl-include=${openssl-dir}/include
	--with-openssl-lib
	--without-openssl-lib=${openssl-dir}/lib
	--with-kerberos-dir
	--without-kerberos-dir
	--with-kerberos-include
	--without-kerberos-include=${kerberos-dir}/include
	--with-kerberos-lib
	--without-kerberos-lib=${kerberos-dir}/lib
	--with-debug
	--without-debug
	--enable-debug
	--disable-debug
	--with-nsl-dir
	--without-nsl-dir
	--with-nsl-include
	--without-nsl-include=${nsl-dir}/include
	--with-nsl-lib
	--without-nsl-lib=${nsl-dir}/lib
	--with-nsllib
	--without-nsllib
	--with-socket-dir
	--without-socket-dir
	--with-socket-include
	--without-socket-include=${socket-dir}/include
	--with-socket-lib
	--without-socket-lib=${socket-dir}/lib
	--with-socketlib
	--without-socketlib
	--with-openssl-config
	--without-openssl-config
	--with-pkg-config
	--without-pkg-config
extconf.rb:113:in `<main>': OpenSSL >= 1.0.1, < 3.0.0 or LibreSSL >= 2.5.0 is required (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/openssl-2.2.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/openssl-2.2.1 for inspection.
Results logged to /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/openssl-2.2.1/gem_make.out

  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:95:in `run'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tempfile.rb:291:in `open'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:161:in `build_extension'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:195:in `block in build_extensions'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:192:in `each'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:192:in `build_extensions'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/installer.rb:847:in `build_extensions'
/Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/rubygems_gem_installer.rb:66:in
`build_extensions'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/rubygems_gem_installer.rb:26:in `install'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/source/rubygems.rb:192:in `install'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/installer/gem_installer.rb:54:in `install'
/Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/installer/parallel_installer.rb:177:in `block
in worker_pool'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/worker.rb:62:in `apply_func'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/worker.rb:57:in `block in process_queue'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/worker.rb:54:in `loop'
  /Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/worker.rb:54:in `process_queue'
/Users/dongxu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/worker.rb:91:in `block (2 levels) in
create_threads'

An error occurred while installing openssl (2.2.1), and Bundler cannot continue.

In Gemfile:
  cose was resolved to 1.2.0, which depends on
    openssl-signature_algorithm was resolved to 1.1.1, which depends on
      openssl

```

---

<div class="post-metadata">

### Author: ![wilson29thid](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wilson29thid/32/173700_2.png) [@wilson29thid](https://meta.discourse.org/u/wilson29thid)
#### Post date: [July 14, 2022, 6:38am UTC](https://meta.discourse.org/t/dev-environment-setup-failed-on-bundle-install/214346/2 "2022-07-14T06:38:16Z")

</div>

I ran into this issue on a new m1 macbook. [This stack overflow post](https://stackoverflow.com/a/69012677/633406) had the solution. I later needed [this post](https://stackoverflow.com/a/70316977/633406) to run `bundle install` because of a postgres issue. Hope that helps!

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [September 10, 2022, 1:22am UTC](https://meta.discourse.org/t/dev-environment-setup-failed-on-bundle-install/214346/3 "2022-09-10T01:22:28Z")

</div>

How do you switch global ruby version? I tried `asdf global ruby 3.1.2` but still stuck on ruby 2.5.0p0 on Mac m1
