<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jeff Dickey</title>
    <description>The latest articles on DEV Community by Jeff Dickey (@jdxcode).</description>
    <link>https://dev.to/jdxcode</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F63393%2F83220e1e-9dd2-4104-a99a-5ab824868895.jpeg</url>
      <title>DEV Community: Jeff Dickey</title>
      <link>https://dev.to/jdxcode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jdxcode"/>
    <language>en</language>
    <item>
      <title>Beginner's Guide to rtx (mise)</title>
      <dc:creator>Jeff Dickey</dc:creator>
      <pubDate>Sat, 04 Mar 2023 19:37:48 +0000</pubDate>
      <link>https://dev.to/jdxcode/beginners-guide-to-rtx-ac4</link>
      <guid>https://dev.to/jdxcode/beginners-guide-to-rtx-ac4</guid>
      <description>&lt;p&gt;&lt;em&gt;NOTE: rtx has been renamed to mise. This post is still relevant but anytime you see "rtx" just replace it with "mise"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/jdxcode/rtx" rel="noopener noreferrer"&gt;rtx&lt;/a&gt; is a tool that  manages installations of programming language runtimes and other tools for local development.&lt;/p&gt;

&lt;p&gt;If you are using pyenv, nvm, or asdf, you'll have a better experience with rtx. It's faster, easier to use, and generally has more features than any of those.&lt;/p&gt;

&lt;p&gt;It's useful if you want to install a specific version of node or python or if you want to use different versions in different projects.&lt;/p&gt;

&lt;p&gt;This guide will cover the 2 most commonly used languages in rtx: node and python, however you can still use this guide for other languages. Just change &lt;code&gt;node&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt; out for &lt;code&gt;java&lt;/code&gt; or &lt;code&gt;ruby&lt;/code&gt; or whatever.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Before we talk about rtx, lets cover some background. It's important to understand these in case something isn't working as expected.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;~/.bashrc&lt;/code&gt; and &lt;code&gt;~/.zshrc&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;These are bash/zsh scripts that are loaded every time you start a new terminal session. We "activate" rtx here so that it is enabled and can modify environment variables when changing directories.&lt;/p&gt;

&lt;p&gt;Not sure which one you're using? Try just running a command that doesn't exist and it should tell you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ some_invalid_command
bash: Unknown command: some_invalid_command
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Environment Variables
&lt;/h3&gt;

&lt;p&gt;Environment variables are a bunch of strings that exist in your shell and get passed to every command that is run. We can use them in any language, in node we use them like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ export MY_VAR=testing-123
$ node -e "console.log('MY_VAR: ', process.env.MY_VAR)"
MY_VAR: testing-123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are often used to change behavior of the commands we run. In essence, what rtx does is 2 things: manage installation of tools and manage their environment variables.&lt;/p&gt;

&lt;p&gt;The latter is mostly invisible to you, but it's important to understand what it is doing, especially with one key environment variable: PATH.&lt;/p&gt;

&lt;h3&gt;
  
  
  PATH environment variable
&lt;/h3&gt;

&lt;p&gt;PATH is a special environment variable. It is fundamental to how your shell works.&lt;/p&gt;

&lt;p&gt;However, it also is just an environment variable like any other. We can display it the same way we did earlier with node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ node -e "console.log('PATH: ', process.env.PATH)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or more commonly we can use &lt;code&gt;echo&lt;/code&gt; (this is simplified, my real one has a lot more directories):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo $PATH
/Users/jdx/bin:/opt/homebrew/bin:/usr/bin:/bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What is special about PATH is how bash/zsh use it. Any time you run a command like &lt;code&gt;node&lt;/code&gt; or &lt;code&gt;python&lt;/code&gt;, but also &lt;code&gt;rm&lt;/code&gt; or &lt;code&gt;mkdir&lt;/code&gt; and most other things, it needs to "find" where that command exists before it can run it.&lt;/p&gt;

&lt;p&gt;This happens behind the scenes, but we can get the "real path" of these tools with &lt;code&gt;which&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ which rm
/bin/rm
$ which node
/opt/homebrew/bin/node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we look at the PATH I had above, we can see that &lt;code&gt;/bin&lt;/code&gt; and &lt;code&gt;/opt/homebrew/bin&lt;/code&gt; are included. bash/zsh will look at each directory in PATH (split on ":"), and check if there is an &lt;code&gt;rm&lt;/code&gt; or &lt;code&gt;node&lt;/code&gt; inside of each one. The first time it finds one, it returns it.&lt;/p&gt;

&lt;p&gt;The way rtx works is it modifies PATH to include the paths to the expected runtimes, so once it is activated, you might see it include a directory like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/Users/jdx/.local/share/rtx/installs/nodejs/18.0.0/bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That directory will contain &lt;code&gt;node&lt;/code&gt; and &lt;code&gt;npm&lt;/code&gt; binaries which will override anything that might be on the "system" (meaning something like &lt;code&gt;/opt/homebrew/bin/node&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing rtx
&lt;/h2&gt;

&lt;p&gt;See the &lt;a href="https://rtx.jdx.dev" rel="noopener noreferrer"&gt;rtx documentation&lt;/a&gt; for instructions on how to install, for macOS I suggest installing with Homebrew:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install rtx
rtx --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can also just download rtx as a single file with curl, then make it executable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl https://rtx.jdx.dev/rtx-latest-macos-arm64 &amp;gt; ~/bin/rtx
chmod +x ~/bin/rtx
rtx --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Warning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Replace "macos" and "arm64" with "linux" or "x64" if using a different OS or architecture.&lt;br&gt;
Also, this assumes that &lt;code&gt;~/bin&lt;/code&gt; is on PATH which won't be the case by default. Add &lt;code&gt;export PATH="$PATH"&lt;/code&gt; to your &lt;code&gt;~/.bashrc&lt;/code&gt; or &lt;code&gt;~/.zshrc&lt;/code&gt; if it isn't already included. &lt;code&gt;rtx -v&lt;/code&gt; will fail otherwise because it can't find &lt;code&gt;rtx&lt;/code&gt; if it's just in some random directory not in PATH.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Activating rtx
&lt;/h2&gt;

&lt;p&gt;In order for rtx to work it should* be activated. To do this, modify your &lt;code&gt;~/.bashrc&lt;/code&gt; or &lt;code&gt;~/.zshrc&lt;/code&gt; and add &lt;code&gt;"$(rtx activate bash)"&lt;/code&gt; or &lt;code&gt;"$(rtx activate zsh)"&lt;/code&gt;. You generally want to put this near the bottom of that file because otherwise &lt;code&gt;rtx&lt;/code&gt; might not be on PATH if it's added earlier in the file.&lt;/p&gt;

&lt;p&gt;In other words, you might have the following in your &lt;code&gt;~/.bashrc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export PATH="$HOME/bin:$PATH"
eval "$(rtx activate bash)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you swap those around it won't work since &lt;code&gt;rtx&lt;/code&gt; won't be included in PATH.&lt;/p&gt;

&lt;p&gt;Once you modify this file, you'll need to run &lt;code&gt;source ~/.bashrc&lt;/code&gt; or &lt;code&gt;source ~/.zshrc&lt;/code&gt; in order for the changes to take effect (or just open a new terminal window).&lt;/p&gt;

&lt;p&gt;You can verify it is working by running &lt;code&gt;rtx doctor&lt;/code&gt;. You should see a message saying "No problems found". If it shows an error, follow the instructions shown.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rtx doctor
rtx version:
  1.21.2 macos-arm64 (built 2023-03-04)

shell:
  /opt/homebrew/bin/fish
  fish, version 3.6.0

No problems found
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(*This isn't strictly true, you can use rtx with shims or with &lt;code&gt;rtx exec&lt;/code&gt;, but generally this is the way you'll want to use rtx.)&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Node.js
&lt;/h2&gt;

&lt;p&gt;Now that rtx is installed and activated we can install node with it, to do this simply run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rtx install nodejs@18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point node is installed, but not yet on PATH so we can't just call &lt;code&gt;node&lt;/code&gt; and run it. To use it we can tell rtx to execute it directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rtx exec nodejs@18 -- npm install
rtx exec nodejs@18 -- node ./app.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In these commands we're calling rtx, telling it to use &lt;code&gt;nodejs@18&lt;/code&gt;, then we say &lt;code&gt;--&lt;/code&gt; which tells rtx to stop listening to arguments and everything after that will be executed as a new command in the environment that rtx created. (If that isn't obvious just keep going, it'll likely make more sense later.)&lt;/p&gt;

&lt;p&gt;Also note that &lt;code&gt;nodejs@18&lt;/code&gt; sets up both the &lt;code&gt;node&lt;/code&gt; and &lt;code&gt;npm&lt;/code&gt; binaries so that &lt;code&gt;npm install&lt;/code&gt; and &lt;code&gt;node ...&lt;/code&gt; both use the same version of node from rtx.&lt;/p&gt;

&lt;p&gt;This is fine for ad-hoc testing or one-off tasks, but it's a lot to type. What we want to do now is make nodejs@18 the default version that will be used when running &lt;code&gt;node&lt;/code&gt; without prefixing it with &lt;code&gt;rtx exec nodejs@18 --&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Make nodejs@18 the global default
&lt;/h3&gt;

&lt;p&gt;To make it the default, run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rtx use --global nodejs@18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What this does is modify the global config (as of this writing that defaults to ~/.tool-versions, but it will eventually be &lt;code&gt;~/.config/rtx/config.toml&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;You can also edit this file manually. It looks like this for &lt;code&gt;~/.tool-versions&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nodejs 18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or this for &lt;code&gt;~/.config/rtx/config.toml&lt;/code&gt; (you can use this today if you want, it's just that &lt;code&gt;rtx use --global&lt;/code&gt; won't &lt;em&gt;write&lt;/em&gt; to this by default currently):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[tools]
nodejs = '18'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now node is on PATH and we can just run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install
node ./app.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's do a bit more digging to see what is actually going on here. If we run &lt;code&gt;echo $PATH&lt;/code&gt; we can see that our PATH has a new entry in it (simplified output):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ echo $PATH
/Users/jdx/.local/share/rtx/installs/nodejs/18.14.2/bin:/opt/homebrew/bin:/usr/bin:/bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we look inside that "rtx/install/nodejs" directory we see the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls /Users/jdx/.local/share/rtx/installs/nodejs/18.14.2/bin
corepack    node        npm     npx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are the commands that node provides. Because this is first in our PATH, these are what bash/zsh will execute when we run them.&lt;/p&gt;

&lt;p&gt;Here are some other rtx commands with example output that can be helpful to see what is going on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;show the location of an rtx bin
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rtx which node 
/Users/jdx/.local/share/rtx/installs/nodejs/18.14.2/bin/node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;get the current version this bin points to
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rtx which node --version
18.14.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;show the directory the current version of nodejs is installed to
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rtx where nodejs
/Users/jdx/.local/share/rtx/installs/nodejs/18.14.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Make nodejs@18 the local default
&lt;/h3&gt;

&lt;p&gt;Let's say we had a project where we wanted to use version 16.x of node instead. We can use rtx to have &lt;code&gt;node&lt;/code&gt; and &lt;code&gt;npm&lt;/code&gt; point to that version instead when in that directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/src/myproj
rtx use nodejs@16
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that by default we don't have to install nodejs@16 ahead of time. rtx will prompt if it is not installed (see the &lt;a href="https://asciinema.org/a/564654" rel="noopener noreferrer"&gt;demo&lt;/a&gt; in this article to see how that looks).&lt;/p&gt;

&lt;p&gt;Now if we're in ~/src/myproj, then rtx will make &lt;code&gt;node&lt;/code&gt; point to v16 and if we're anywhere else it will use v18.&lt;/p&gt;

&lt;h2&gt;
  
  
  Upgrading node versions
&lt;/h2&gt;

&lt;p&gt;If you want to use a new major version of node, then set it with &lt;code&gt;rtx use --global nodejs@20&lt;/code&gt; or &lt;code&gt;rtx use nodejs@20&lt;/code&gt;. You can also use &lt;code&gt;nodejs@lts&lt;/code&gt; for LTS version or &lt;code&gt;nodejs@latest&lt;/code&gt; for the latest version.&lt;/p&gt;

&lt;p&gt;If you just want to update to a new minor or patch version (&lt;code&gt;18.1.0&lt;/code&gt; or &lt;code&gt;18.0.1&lt;/code&gt;, for example), then all you need to do is run &lt;code&gt;rtx install&lt;/code&gt; so long as &lt;code&gt;nodejs 18&lt;/code&gt; is what is in &lt;code&gt;~/.tool-versions&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can remove old versions no longer referenced with &lt;code&gt;rtx prune&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Python
&lt;/h2&gt;

&lt;p&gt;Now let's look at installing python which is a bit more complex than node and has some unique quirks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Make python@latest the global default
&lt;/h3&gt;

&lt;p&gt;We can default python to the latest version of by using the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rtx use --global python@latest
python --version
pip --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create many new bins we can call like &lt;code&gt;python&lt;/code&gt;, &lt;code&gt;python3&lt;/code&gt;, &lt;code&gt;python3.11&lt;/code&gt;, &lt;code&gt;pip&lt;/code&gt;, &lt;code&gt;pip3&lt;/code&gt;, and &lt;code&gt;pip3.11&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Make &lt;a href="mailto:python@3.11"&gt;python@3.11&lt;/a&gt; the local default
&lt;/h3&gt;

&lt;p&gt;We can also set local versions just like with node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rtx use python@3.11 
python --version
pip --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Multiple python versions
&lt;/h3&gt;

&lt;p&gt;With python we can use multiple versions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rtx use --global python@3.11 python@3.10
python --version
python3.10 --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will make &lt;code&gt;python&lt;/code&gt; and &lt;code&gt;python3&lt;/code&gt; use v3.11 and we can use v3.10 by running &lt;code&gt;python3.10&lt;/code&gt; or &lt;code&gt;pip3.10&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Managing virtualenv with rtx
&lt;/h3&gt;

&lt;p&gt;We can have rtx automatically setup a virtualenv (virtualenvs themselves are out of scope for this article) by using the following &lt;code&gt;.rtx.toml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[tools]
python = {version='3.10', virtualenv='.venv'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whenever inside of this directory, the &lt;code&gt;.venv&lt;/code&gt; virtualenv will be created if it does not exist and rtx will automatically activate the virtualenv.&lt;/p&gt;

&lt;h2&gt;
  
  
  Arbitrary environment variables with rtx
&lt;/h2&gt;

&lt;p&gt;One of rtx's most loved features is the ability to set arbitrary env vars in different directories. This replaces what people commonly use dotenv and direnv for.&lt;/p&gt;

&lt;p&gt;To do this, you need to use &lt;code&gt;.rtx.toml&lt;/code&gt; instead of &lt;code&gt;.tool-versions&lt;/code&gt; since the latter could not support this syntax. Just create this file in any directory you want the environment variables to take effect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[env]&lt;/span&gt;
&lt;span class="py"&gt;NODE_ENVIRONMENT&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"production"&lt;/span&gt;
&lt;span class="py"&gt;S3_BUCKET&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"my_s3_bucket"&lt;/span&gt;
&lt;span class="py"&gt;AWS_ACCESS_KEY_ID&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"..."&lt;/span&gt;
&lt;span class="py"&gt;AWS_SECRET_ACCESS_KEY&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"..."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As long as rtx is activated, these environment variables will be setup whenever inside of that directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shims
&lt;/h2&gt;

&lt;p&gt;Shims are an optional feature that can be used in some cases in rtx where things don't work as expected. See the rtx docs for more on how shims work.&lt;/p&gt;

&lt;p&gt;If you want to integrate rtx with your IDE you'll likely want to use shims for that (but I recommend keeping &lt;code&gt;rtx activate&lt;/code&gt; for usage in the terminal unless you have a unique setup where this doesn't work well).&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparisons to other tools
&lt;/h2&gt;

&lt;p&gt;Let's examine other ways to install node/python and see how they compare:&lt;/p&gt;

&lt;h3&gt;
  
  
  Node/Python Official .pkg
&lt;/h3&gt;

&lt;p&gt;For macOS, if you go the official node and python websites they'll offer a .pkg installer to install node and python. I don't recommend these for a few reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No ability to update. If you want to get the latest version, you need to go to the website and reinstall. That should ideally be a single CLI command.&lt;/li&gt;
&lt;li&gt;No ability to use multiple versions. If you have multiple projects that need different versions you won't be able to use this method.&lt;/li&gt;
&lt;li&gt;Can conflict with PATH. If you have node or python installed by some other means, this can either override that install or not work because it is being overridden. Using rtx makes it easy to control when languages should and should not override the system versions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How is rtx different than asdf?
&lt;/h3&gt;

&lt;p&gt;rtx is very similar to asdf and behaves as a drop-in replacement for almost any use-case. See the docs for more details on this. rtx can be thought of as a clone of asdf with extra features.&lt;/p&gt;

&lt;p&gt;Under the hood, rtx uses asdf plugins so the logic for actually installing node and python is the same for both asdf and rtx. That's true today at least, rtx may diverge and fork asdf plugins to enable rtx-specific behavior if needed.&lt;/p&gt;

&lt;p&gt;However it is much faster, has better UX, and it has extra features like the ability to modify arbitrary env vars (&lt;code&gt;FOO=bar&lt;/code&gt;), or manage Python virtualenvs.&lt;/p&gt;

&lt;p&gt;asdf is burdened by being written in bash which is very slow and greatly limits their capabilities. asdf can never be as fast or feature-complete as rtx just because it's written in bash. They would need a ground-up rewrite: which is rtx.&lt;/p&gt;

&lt;p&gt;So far as I'm aware, there should be no use-case where asdf is a better fit than rtx.&lt;/p&gt;

&lt;h3&gt;
  
  
  How is rtx different than Homebrew?
&lt;/h3&gt;

&lt;p&gt;Tools like Homebrew are great (it's how I install most of my tools on macOS), but it won't have the latest version of tools when they come out since there is a manual process to update them.&lt;/p&gt;

&lt;p&gt;Homebrew also does not let you use different versions in different directories (at least, not without manually modifying PATH). It doesn't let you install a specific version (e.g.: nodejs-18.0.0 instead of nodejs-18.0.1). It has some support for different major versions in some languages like: &lt;code&gt;brew install nodejs@18&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Use homebrew if you just want to use the latest version of the tool and don't need different versions in different directories. rtx requires a bit more yak-shaving that isn't necessary for a lot of tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  How is rtx different than apt-get/yum/dnf?
&lt;/h3&gt;

&lt;p&gt;Most Linux distros strive to maintain compatibility and do not allow new software into existing distributions. Because of this, they do not even include node since the versions change too fast and they go end-of-life when the distribution is still under LTS.&lt;/p&gt;

&lt;p&gt;Python is included but it's often old or very old.&lt;/p&gt;

&lt;p&gt;If python is just some system dependency you don't interact with much this is fine and ideal for compatibility reasons. However if you're writing python yourself, you'll want to use a much more modern version.&lt;/p&gt;

&lt;p&gt;Multiple versions is also not terribly well supported by these mechanisms. It can be done, but in a seamless way where you just change directory and it magically has the right language versions in different directories.&lt;/p&gt;

&lt;p&gt;You should install python in your Linux packages, but don't develop python projects using that version.&lt;/p&gt;

&lt;h3&gt;
  
  
  How is rtx different than nvm/pyenv?
&lt;/h3&gt;

&lt;p&gt;These are the most well known tools for switching between node and python versions. They function well, but they're very slow.&lt;/p&gt;

&lt;p&gt;These also only work for a single language where rtx can be used to work with any language. It's only one tool to setup and if you want to pick up a different language you don't need to figure out a new tool.&lt;/p&gt;

</description>
      <category>python</category>
      <category>node</category>
      <category>asdf</category>
      <category>rtx</category>
    </item>
  </channel>
</rss>
