Install Deno on Windows, Linux, and Mac Operating Systems
Oct 20, 2022
In the official Deno documentation, there are shell commands to install Deno on Windows, Mac, and Linux. We will run that command and for Mac and Linux we will have to update the bashrc
or zshrc
file with a script.
In this post, I just explained in more detail what the docs said. So, It’s safe to follow the instructions, and also running these commands on your computer will not modify your system. You are just installing an application and that’s all.
Deno Installation on Windows OS
Click on the Start or Press Windows Key, type PowerShell, and then click Windows PowerShell. It will open PowerShell on your windows.
Now, Paste the command from below on PowerShell and hit Enter.
irm https://deno.land/install.ps1 | iex
It will take a while to download and finish the installation.
After successfully installed type deno --version
on PowerShell and hit Enter
to verify if Deno installed or not.
Deno Installation on Mac or Linux OS
If you are on Linux, first you have to install curl
for installing Deno. Because most Linux distributions work with wget
which is another command-line utility for downloading files from the web.
curl
is usually available by default on Macs, so you don’t have to install it. Still, you can check it by running curl -V
on your terminal.
To install curl on Ubuntu/Debian OS, run the command below.
sudo apt install curl
Now, run the next command on your terminal to download and install Deno.
curl -fsSL https://deno.land/x/install/install.sh | sh
You will get a message like below after successfully installing Deno.
Archive: /YOUR_USERNAME/.deno/bin/deno.zip
inflating: deno
Deno was installed successfully to /home/YOUR_USERNAME/.deno/bin/deno
Manually add the directory to your $HOME/.bash_profile (or similar)
export DENO_INSTALL="/home/YOUR_USERNAME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
Run '/YOUR_USERNAME/.deno/bin/deno --help' to get started
As the message says, you have to manually add the script in your bashrc
or zshrc
file.
How to Manually add the directory in $HOME/.bash_profile
or $HOME/.zshrc
There are two ways to open your bashrc
or zshrc
file. Try any method from below.
Method 1: Use file manager to open bashrc
or zshrc
Open the Home($HOME
) directory on your file manager. By default, File managers start with the home directory. Also, make sure you have turned on the Show hidden files
option on your computer.
You will be able to see the bashrc
or zshrc
file on your file manager. Open the file with your favorite text editor.
Method 2: Use the terminal to open bashrc
or zshrc
If you are in Ubuntu, you will have Gedit text editor installed, or even if you don’t have it installed you can use Nano editor.
For macOS try the nano command also.
# for gedit text editor
gedit ~/.bashrc
# or for GNU nano editor
nano ~/.bashrc
After successfully opening the bashrc
or zshrc
file on your text editor, copy the script from the Deno installation message and paste it at the end of the line.
If you lost the message, try the code below. Just make sure to replace YOUR_USERNAME
with your pc username (i.e., john).
# deno
export DENO_INSTALL="/home/YOUR_USERNAME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
Next, save the file and close the editor and terminal. I believe that’s all you have to do to install Deno.
Now, open up your terminal again and run the command below to verify that Deno has been installed successfully.
deno --version
You should get the output of the Deno and Typescript version.
Conclusion
Well, Good Luck with Deno Web Development. I am a fan of Typescript. That is why I am happy that they released Deno alongside Node JS.
If you use VS Code text editor, there is an official plugin you should install to ignore .ts
import error and enable Deno IntelliSense in VS Code.