# Multiple rubies / rbenv is painful (Chefdk inside Docker for Mac?)

**URL:** <https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839>\
**Category:** Chef Infra (archive)\
**Created:** [July 2, 2016, 7:47pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839 "2016-07-02T19:47:03Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrjcleaver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/mrjcleaver/32/1393_2.png) [@mrjcleaver](https://discourse.chef.io/u/mrjcleaver)\
**Post date:** [July 2, 2016, 7:47pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/1 "2016-07-02T19:47:03Z")

</div>

I do ruby development on my Mac, as well as deploy Chef code.

https ://docs.chef.io/install\_dk.html states:

> Using the Chef development kit-provided Ruby as your system Ruby is optional. This just depends on how you are using Ruby on your system. For many users, Ruby is primarily used for authoring Chef cookbooks and recipes. If that’s true for you, then using the Chef development kit-provided Ruby as your system Ruby is recommended. But for other users who are already using tools like rbenv to manage Ruby versions, then that’s OK too.

It would be more helpful if there was a documented way on the site as exactly how to do this. https ://github.com/chef/chef-dk#using-chefdk-as-your-primary-development-environment doesn't shed light on it.

In the past I've tried adding chefdk as a rbenv version, which worked until, well, until it didn't at which point it just utterly confused my teammate.

We've once worked with ChefDK in a VM, which is all a bit heavy.

Docker for Mac now exists (in Beta) [Sign in to Docker Desktop | Docker Docs](https://docs.docker.com/docker-for-mac/)

How about an officially maintained, documented and supported ChefDK-in-Docker & Dockerfile in which all configuration is set, to isolate us from Ruby version hell?

Sure... they are out there (21 and counting)... [https://github.com/search?o=desc&q=docker-chefdk&s=updated&type=Repositories&utf8=✓](https://github.com/search?o=desc&q=docker-chefdk&s=updated&type=Repositories&utf8=%E2%9C%93)

Let's not have everyone choose. Let's do this together.

Thanks,  
Martin.

PS. I had to break 2 of the URLs to pass the "new user" filter.

---

<div class="post-metadata">

**Author:** ![jeffbyrnes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeffbyrnes/32/1478_2.png) [@jeffbyrnes](https://discourse.chef.io/u/jeffbyrnes)\
**Post date:** [July 2, 2016, 8:50pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/2 "2016-07-02T20:50:50Z")

</div>

I’m on a trip with minima internet access, but when I get back to  
civilization next Wed, I’ll document my setup, which does indeed mix rbenv  
with ChefDK (and doesn’t set ChefDK as an rbenv “version”).

Jeff Byrnes  
[thejeffbyrnes.com](http://thejeffbyrnes.com)  
@thejeffbyrnes [https://twitter.com/thejeffbyrnes](https://twitter.com/thejeffbyrnes)

---

<div class="post-metadata">

**Author:** ![mrjcleaver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/mrjcleaver/32/1393_2.png) [@mrjcleaver](https://discourse.chef.io/u/mrjcleaver)\
**Post date:** [July 6, 2016, 1:45pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/3 "2016-07-06T13:45:43Z")

</div>

Thanks, Jeff.

I look forward to your input!

Regards, M.

---

<div class="post-metadata">

**Author:** ![mrjcleaver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/mrjcleaver/32/1393_2.png) [@mrjcleaver](https://discourse.chef.io/u/mrjcleaver)\
**Post date:** [July 7, 2016, 12:31am UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/4 "2016-07-07T00:31:02Z")

</div>

Looks like [https://github.com/chef/chef-dk/issues/313](https://github.com/chef/chef-dk/issues/313) is much the same set of problems.

---

<div class="post-metadata">

**Author:** ![mrjcleaver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/mrjcleaver/32/1393_2.png) [@mrjcleaver](https://discourse.chef.io/u/mrjcleaver)\
**Post date:** [July 7, 2016, 1:57pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/5 "2016-07-07T13:57:13Z")

</div>

It’s also remiss of me to not mention [https://github.com/docwhat/rbenv-chefdk](https://github.com/docwhat/rbenv-chefdk)

---

<div class="post-metadata">

**Author:** ![jeffbyrnes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeffbyrnes/32/1478_2.png) [@jeffbyrnes](https://discourse.chef.io/u/jeffbyrnes)\
**Post date:** [July 7, 2016, 5:17pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/6 "2016-07-07T17:17:28Z")

</div>

So `chef/chef-dk#313` lays the issue out in great detail. Let’s hope an official solution comes of that.

I have not used `rbenv-chefdk`, but I did come across it some time ago.

My solution is thus:

1. Set up all the other things I need in my path
2. Run the `rbenv init`
3. Add the ChefDK paths to my `$PATH`

Looks kinda like this:

```auto
export PATH=/other/bins:$PATH

# Enable rbenv shims and autocompletion
# github.com/sstephenson/rbenv/
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

# ChefDK binaries
# Added after rbenv to avoid path issues
export PATH="/opt/chefdk/bin:$PATH"

# chef gem-installed binaries
export PATH="$HOME/.chefdk/gem/ruby/2.1.0/bin:$PATH"

```

I end up with (line breaks added for easier reading):

```auto
♠ echo $PATH
/Users/jeffbyrnes/.chefdk/gem/ruby/2.1.0/bin:
/opt/chefdk/bin:
/usr/local/var/rbenv/shims:
/Users/jeffbyrnes/dev/devops/evertools/scripts:
/usr/local/heroku/bin:
/Users/jeffbyrnes/.cabal/bin:
/Users/jeffbyrnes/.go/bin:
/usr/local/opt/coreutils/libexec/gnubin:
/Users/jeffbyrnes/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/opt/X11/bin:
/usr/local/MacGPG2/bin

```

It’s rather non-standard, and I don’t get the ChefDK bash completion, but it’s worked well for a long time.

---

<div class="post-metadata">

**Author:** ![mrjcleaver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/mrjcleaver/32/1393_2.png) [@mrjcleaver](https://discourse.chef.io/u/mrjcleaver)\
**Post date:** [July 11, 2016, 3:22pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/7 "2016-07-11T15:22:25Z")

</div>

Thanks Jeff, I appreciate it.

I’ll try your solution today (I’m at ChefConf, BTW).

I’ve also posted [https://feedback.chef.io/forums/301644-chef-product-feedback/suggestions/15152973-chefdk-needs-to-be-rbenv-aware](https://feedback.chef.io/forums/301644-chef-product-feedback/suggestions/15152973-chefdk-needs-to-be-rbenv-aware)

---

<div class="post-metadata">

**Author:** ![jeffbyrnes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeffbyrnes/32/1478_2.png) [@jeffbyrnes](https://discourse.chef.io/u/jeffbyrnes)\
**Post date:** [July 11, 2016, 4:41pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/8 "2016-07-11T16:41:05Z")

</div>

You’re welcome. I’m not at ChefConf, or I’d offer to get together & help you out in-person. Best of luck!

Jeff Byrnes  
@thejeffbyrnes  
[thejeffbyrnes.com](http://thejeffbyrnes.com)

---

<div class="post-metadata">

**Author:** ![mrjcleaver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/mrjcleaver/32/1393_2.png) [@mrjcleaver](https://discourse.chef.io/u/mrjcleaver)\
**Post date:** [July 16, 2016, 4:08pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/9 "2016-07-16T16:08:51Z")

</div>

Some intense work has gone on over the last few days, culminating in a new release of rbenv-chefdk.

Hopefully the changes will be sufficient to cover the issues! It solved my problems. (The other of which was Bundle exec was failing because there was a undeclared dependency on rb-readline in the ChefDK). Luckily @jkeiser was at ChefChef2016, was a nice enough to spend time to hack through the issue. [https://github.com/docwhat/rbenv-chefdk/issues/13#issuecomment-232841828](https://github.com/docwhat/rbenv-chefdk/issues/13#issuecomment-232841828)

Maybe you’d like to try it?

---

<div class="post-metadata">

**Author:** ![jeffbyrnes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeffbyrnes/32/1478_2.png) [@jeffbyrnes](https://discourse.chef.io/u/jeffbyrnes)\
**Post date:** [July 18, 2016, 2:12pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/10 "2016-07-18T14:12:28Z")

</div>

I’ll be setting up a new Mac on Aug 1, I’ll take this for a spin then! Thanks so much to both of you for improving this whole thing; it’ll be awesome to use Chef’s Ruby in this fashion.

---

<div class="post-metadata">

**Author:** ![jeffbyrnes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeffbyrnes/32/1478_2.png) [@jeffbyrnes](https://discourse.chef.io/u/jeffbyrnes)\
**Post date:** [August 1, 2016, 8:46pm UTC](https://discourse.chef.io/t/multiple-rubies-rbenv-is-painful-chefdk-inside-docker-for-mac/8839/11 "2016-08-01T20:46:07Z")

</div>

Hmm, no dice on using `rbenv-chefdk`; it just spits out:

```auto
♠ rbenv shell chefdk
rbenv: version `chefdk' not installed

```

after I’ve cloned the repo into the specified path. Oh well!
