{"componentChunkName":"component---src-templates-post-template-js","path":"/ruby-m1","webpackCompilationHash":"9f9b08718447f3d4e396","result":{"data":{"markdownRemark":{"id":"a5b0bfee-8d6e-5919-9f6e-7042b875cfed","html":"<p>I was setting up my dev environment for a rails 5 app that runs with ruby 2.4.x and a good mix of gems.</p>\n<p>The gems ffi, pg, mysql2, mimemagic and sassc needed some extra steps besides the regular bundle install, here’s what I did:</p>\n<h2 id=\"postgres\"><a href=\"#postgres\" aria-label=\"postgres permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Postgres</h2>\n<p>Use brew to install postgres, its actually easier than using Postgres.app</p>\n<h2 id=\"ffi-1918\"><a href=\"#ffi-1918\" aria-label=\"ffi 1918 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>ffi 1.9.18</h2>\n<ul>\n<li>brew install libffi</li>\n<li>type this in a terminal to set them as env variables\n<code class=\"language-text\">export LDFLAGS=&quot;-L/opt/homebrew/opt/libffi/lib&quot;\nexport CPPFLAGS=&quot;-I/opt/homebrew/opt/libffi/include&quot;\nexport PKG_CONFIG_PATH=&quot;/opt/homebrew/opt/libffi/lib/pkgconfig&quot;</code></li>\n<li>run the install with this cflags\n<code class=\"language-text\">gem install ffi -v &#39;1.9.18&#39; -- --with-cflags=&quot;-Wno-error=implicit-function-declaration&quot;</code></li>\n</ul>\n<h2 id=\"mysql2\"><a href=\"#mysql2\" aria-label=\"mysql2 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>mysql2</h2>\n<ul>\n<li>Install mysql, openssl and zstd</li>\n<li>brew install mysql</li>\n<li>brew install openssl</li>\n<li>brew install zstd</li>\n</ul>\n<p>Then use this flags on the gem installation:\n<br>\n<code class=\"language-text\">gem install mysql2  -v &#39;0.5.2&#39; -- --with-opt-dir=&quot;$(brew --prefix openssl)&quot; --with-ldflags=-L/opt/homebrew/Cellar/zstd/1.5.0/lib</code></p>\n<p>If you need the path for zstd lib because its different than mine, you can find it like this\n<code class=\"language-text\">ls -la $(which zstd)</code></p>\n<h2 id=\"mimemagic\"><a href=\"#mimemagic\" aria-label=\"mimemagic permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>mimemagic</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\"> brew install shared-mime-info\n gem install mimemagic -v &#39;0.3.10&#39;</code></pre></div>\n<h2 id=\"sassc\"><a href=\"#sassc\" aria-label=\"sassc permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>sassc</h2>\n<p>In this case I just updated the gem because they solved the issue in newer versions.\n<code class=\"language-text\">bundle update sassc</code>\nIt installed without issues using v2.4.0</p>\n<h2 id=\"miniracer\"><a href=\"#miniracer\" aria-label=\"miniracer permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>miniracer</h2>\n<p>While trying to run rake tasks, mini_racer throw some errors.:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V813InitializeICUEPKc  Referenced from: /Users/&lt;user&gt;/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mini_racer-0.2.6/lib/mini_racer_extension.bundle</code></pre></div>\n<p><br>\nThey addressed those issues on newer versions, so again, just updating the gem does the trick:<br>\n<code class=\"language-text\">bundle update mini_racer</code></p>","fields":{"slug":"ruby-m1","tagSlugs":["/tag/apple-silicon/","/tag/m-1/","/tag/ruby-env/","/tag/ffi/","/tag/mysql-2/","/tag/postgresql/","/tag/pg/","/tag/sassc/","/tag/brew/"]},"frontmatter":{"date":"2021-06-19T21:51:38.502Z","description":"A quick collection of workarounds that I had to do to be able to setup one of my rails environments on apple silicon (big sur) on a MacBook m1.","tags":["apple silicon","m1","ruby env","ffi","mysql2","postgresql","pg","sassc","brew"],"title":"Rails env setup, Apple Silicon (M1) troubleshooting","socialImage":null}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"slug":"ruby-m1"}}}