![]() ![]() To make sure we have everything installed properly, we are going to create a new test Phoenix project. If you have already setup Homebrew before the M1 upgrade, it would have been installed on /usr/local/homebrew. Run createuser to create the user, make sure to substitute the version of Postgres. Phoenix expects a default Postgres user to be present. brew services restart the default postgres user. brew install Postgres to make sure the service is running. This installs the Postgresql and starts the service that runs in the background. We are using the latest version of Postgres. You have to set it up so you have access to a database on your developing machine. Postgresql is the database of choice for new Phoenix apps. ![]() Running this command installs or upgrades hex. You have to set it up to download Phoenix. Hex is the package manager for Elixir and Erlang and mix is the tool for managing dependencies. Since we have setup Elixir we can setup Phoenix and Postgresql.īefore setting up Phoenix, reshim ASDF so the binaries are all linked up properly. Run iex to make sure the installation is successful. Validate if the installation has succeeded Since we have the OTP version 25 installed, we’ll select the latest version that has been compiled with the OTP release. List all available Elixir versions from ASDF asdf list-all elixir That means we have OTP version 25 installed by our system. Take a note of the version number, which might come out as 25.2. When installing Elixir version make sure you have a corresponding Erlang version installed first.Ĭheck which version of Erlang is installed on your system. ASDF Elixir downloads pre-compiled versions of the run-time. # Lists all the erlang versionsĮvery Elixir version has a list of Erlang versions that it supports. This is useful when you want to install older versions of Elixir that are tied to specific OTP versions. You can install specific version of Erlang if you want to. # Downloads and installs the latest version export KERL_CONFIGURE_OPTIONS="-disable-debug -disable-silent-rules -without-javac -enable-shared-zlib -enable-dynamic-ssl-lib -enable-threads -enable-kernel-poll -enable-wx -enable-webview -enable-darwin-64bit -enable-gettimeofday-as-os-system-time -with-ssl=$(brew -prefix KERL_BUILD_DOCS="yes"ĭownload and install the latest version of Erlang and set it as the default global version. These flags disable linking with Java, which is only required if you want to interface with Java. Erlang compile time flags are configured by setting the KERL_CONFIGURE_OPTIONS shell function. Optional: Since Erlang is compiled on our machine, it is recommended to set compile time flags to get an optimal binary. Even if you have OpenSSL installed, you need version 1.1. OpenSSL is required for secure communication and WxWidgets is needed for rendering out the debugger and observer. asdf plugin add erlang ĪSDF downloads source files and compiles Erlang on our machine. Install the Erlang plugin and dependencies for ASDF. So we have to setup Erlang first and then setup Elixir. This sets the path correctly for the different tools.Įlixir is built on top of Erlang. Select what Shell you use and setup the script properly. Prefer the official git method for installation, as ASDF would then manage itself. Head on over to /guide/getting-started.html and setup ASDF. We are going to use ASDF to setup Elixir and Erlang globally. ASDF keeps the versions of the different tools used in a. ASDF is a single package manager with a plugin interface that can handle multiple languages and their versions. This lead to a lot of conflicts between the tools. Previously we had to setup multiple tools to manage multiple environments, like rbenv for Ruby, nvm for NodeJS, each with it’s own configurations and usage syntax. Multiple projects also require multiple versions of the same environment to be present. The script will install XCode Command Line tools and setup the Homebrew directory on /opt/homebrew.ĭevelopment requires multiple language runtimes to be present on the system. Follow the official instructions at brew.sh and setup Homebrew on the machine. You can install most packages required for development and other applications with a single command. Homebrew is the de-facto package manager on macOS. If you have your M1 mac setup with rosetta, make sure to run the installation process on a native terminal to prevent segmentation faults while building. ![]() If you have already setup any of the tools mentioned, feel free to skip that part. This guide assumes you have a fresh mac and we’ll setup everything from the start. In this blog post we’ll see how to setup Erlang and Elixir on your M1, M2 Mac with Homebrew and ASDF. How to setup Elixir, Phoenix and Postgresql on MacOS M1, M2 ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |