[{"data":1,"prerenderedAt":396},["ShallowReactive",2],{"Categories":3,"NavIndexCategoriesCountFooter":203,"content-\u002F2016\u002F03\u002F09\u002Fmigrating-to-chruby\u002F":204},[4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202],{"category":5},"System Administration",{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},"Software Development",{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":27},{"category":27},{"category":67},"Drones & RC",{"category":69},"DIY Projects",{"category":67},{"category":72},"Photography",{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":67},{"category":67},{"category":72},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":5},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":67},{"category":67},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":72},{"category":67},{"category":138},"3D Printing - Laser Cutting - CNC",{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":5},{"category":138},{"category":27},{"category":27},{"category":138},{"category":138},{"category":72},{"category":158},"Photography,3D Printing - Laser Cutting - CNC",{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":67},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":181},"Home Assistant",{"category":181},{"category":72},{"category":27},{"category":27},{"category":72},{"category":138},{"category":5},{"category":72},{"category":72},{"category":138},{"category":27},{"category":181},{"category":181},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},191,{"id":205,"title":206,"body":207,"category":383,"date":384,"description":282,"embedImage":383,"extension":385,"image":383,"intro":386,"meta":387,"navigation":388,"path":389,"seo":390,"series":383,"sitemap":391,"stem":392,"tags":393,"__hash__":395},"content\u002F2016\u002F03\u002F09\u002Fmigrating-to-chruby.md","Migrating to chruby",{"type":208,"value":209,"toc":377},"minimark",[210,215,236,245,254,263,266,269,272,283,286,292,295,301,310,313,319,322,325,328,331,337,340,346,349,353,356,362,365,368,374],[211,212,214],"h3",{"id":213},"migration","Migration",[216,217,218,219,229,230,235],"p",{},"Up until recently I have been using ",[220,221,228],"a",{"href":222,"rel":223,"target":227},"https:\u002F\u002Fgithub.com\u002Frbenv\u002Frbenv",[224,225,226],"nofollow","noopener","noreferer","_blank","rbenv"," as my ruby install manager (along with ",[220,231,234],{"href":232,"rel":233,"target":227},"https:\u002F\u002Fgithub.com\u002Frbenv\u002Fruby-build",[224,225,226],"ruby-build",").",[216,237,238,239,244],{},"I switched to this a long time back from ",[220,240,243],{"href":241,"rel":242,"target":227},"https:\u002F\u002Frvm.io\u002F",[224,225,226],"rvm"," - with rvm I was having a number of issues with library versions of iconv, xml etc that rbenv didn't seem to have.",[216,246,247,248,253],{},"Yesterday I heard about ",[220,249,252],{"href":250,"rel":251,"target":227},"https:\u002F\u002Fgithub.com\u002Fpostmodern\u002Fchruby",[224,225,226],"chruby"," - which does not rely on shimmed binaries - it simply changes the environment (PATH etc) to point to the ruby you want. This seems a lot simpler\u002Fcleaner conceptually.",[216,255,256,257,262],{},"Since ruby-build is written alongside rbenv and the chruby dev writes ",[220,258,261],{"href":259,"rel":260,"target":227},"https:\u002F\u002Fgithub.com\u002Fpostmodern\u002Fruby-install",[224,225,226],"ruby-install"," alongside chruby we might as well change to that too.",[216,264,265],{},"So I decided to try it out.",[216,267,268],{},"This is on OSX using homebrew (my normal development setup).",[216,270,271],{},"Let's get rid of the rbenv bits",[273,274,279],"pre",{"className":275,"code":277,"language":278},[276],"language-text","brew uninstall rbenv ruby-build\n","text",[280,281,277],"code",{"__ignoreMap":282},"",[216,284,285],{},"Now install chruby and ruby-install",[273,287,290],{"className":288,"code":289,"language":278},[276],"brew install chruby ruby-install\n",[280,291,289],{"__ignoreMap":282},[216,293,294],{},"Now - you then can add the following to your bashrc\u002Fzshrc:",[273,296,299],{"className":297,"code":298,"language":278},[276],"source \u002Fusr\u002Flocal\u002Fshare\u002Fchruby\u002Fchruby.sh\n",[280,300,298],{"__ignoreMap":282},[216,302,303,304,309],{},"But - for zsh I'm using ",[220,305,308],{"href":306,"rel":307,"target":227},"https:\u002F\u002Fgithub.com\u002Fsorin-ionescu\u002Fprezto",[224,225,226],"zprezto"," with ruby module loaded and this has support for rvm, rbenv and chruby built in - so I didn't need that.",[216,311,312],{},"In any case - start a new instance of the shell and then install the latest ruby - I wanted both 2.3.0 and 2.2.4",[273,314,317],{"className":315,"code":316,"language":278},[276],"ruby-install ruby 2.3.0\nchruby ruby-2.3.0\ngem install bundler\nruby-install ruby 2.2.4\nchruby ruby-2.2.4\ngem install bundler\n",[280,318,316],{"__ignoreMap":282},[216,320,321],{},"Since all my projects use bundler\u002FGemfile - I do need bundler installed for each ruby",[216,323,324],{},"Now - all I wanted to add was default to 2.3.0 - so at the end of my zsh initialization I just added",[216,326,327],{},"chruby ruby-2.3.0",[216,329,330],{},"And finally - I want it to pay attention to .ruby_version files - which you can do by adding the following to bashrc\u002Fzshrc",[273,332,335],{"className":333,"code":334,"language":278},[276],"source \u002Fusr\u002Flocal\u002Fshare\u002Fchruby\u002Fauto.sh\n",[280,336,334],{"__ignoreMap":282},[216,338,339],{},"In zprezto's ruby module - instead all you need to do is to add the following to .zpreztorc",[273,341,344],{"className":342,"code":343,"language":278},[276],"zstyle ':prezto:module:ruby:chruby' auto-switch 'yes'\n",[280,345,343],{"__ignoreMap":282},[216,347,348],{},"You can configure chruby to see the rbenv\u002Frvm installed rubies - but I chose to reinstall and to remove the older ruby installations - seems cleaner.",[211,350,352],{"id":351},"bundler","Bundler",[216,354,355],{},"Slightly related - I use the following in my ~\u002F.bundle\u002Fconfig file",[273,357,360],{"className":358,"code":359,"language":278},[276],"---\nBUNDLE_PATH: vendor\u002Fbundle\n",[280,361,359],{"__ignoreMap":282},[216,363,364],{},"This means that when I run bundle in the root of a project - all gems are installed to vendor\u002Fbundle in that project directory.",[216,366,367],{},"And then in my ~\u002F.gitignore I add",[273,369,372],{"className":370,"code":371,"language":278},[276],"vendor\u002Fbundle\n",[280,373,371],{"__ignoreMap":282},[216,375,376],{},"This gives me a completely separate bundle for each project - but makes sure that the git repository doesn't get the files. The only thing it then requires is that you run things with bundle exec - which has become a habit.",{"title":282,"searchDepth":378,"depth":378,"links":379},2,[380,382],{"id":213,"depth":381,"text":214},3,{"id":351,"depth":381,"text":352},null,"2016-03-09 08:54 +0100","md","Moving from rbenv to chruby",{},true,"\u002F2016\u002F03\u002F09\u002Fmigrating-to-chruby",{"title":206,"description":282},{"loc":389},"2016\u002F03\u002F09\u002Fmigrating-to-chruby",[394,243,228,252,234,261,351],"ruby","1KsfVB6brGOTOuXkLhHFwJGiaWLDlKW8fxY8gBgM-wQ",1775293011786]