rmate with sudo

I honestly don’t know if there are still any dinosaurs like me using TextMate
in 2025. But if you’re a die-hard TextMate fan like I am, then I’ve got some
exciting news for you. Have you ever heard of rmate?

rmate is actually a Ruby gem. What does it …


This content originally appeared on DEV Community and was authored by Uğur "vigo" Özyılmazel

I honestly don’t know if there are still any dinosaurs like me using TextMate
in 2025. But if you’re a die-hard TextMate fan like I am, then I’ve got some
exciting news for you. Have you ever heard of rmate?

rmate is actually a Ruby gem. What does it do? It lets you open a file from
a remote server (via SSH) directly in your local TextMate editor—just as if
you had run mate /path/to/file on your own machine.

In TextMate, under Settings > Terminal, there’s an option called Accept rmate connections—make sure that’s checked first.

Next, connect to your VPS via SSH and install Ruby, followed by rmate, using the commands below. Let’s assume you’re using Ubuntu as your VPS operating system:

sudo apt install ruby -y

Now, find the location for user installation directory for
ruby gems:

gem environment | grep "USER INSTALLATION DIRECTORY" | awk -F': ' '{print $2}'
# something like:
# /home/ubuntu/.local/share/gem/ruby/3.2.0/bin

Now, edit your ~/.bashrc and add this path to your PATH environment
variable:

# set PATH if local ruby gems bin exists
PATH="${PATH}:${HOME}/.local/share/gem/ruby/3.2.0/bin"

Save and exit from nano. Now install rmate:

gem install --user-install rmate

Now, restart your shell, logout/login works fine. Now run:

sudo visudo

Edit your sudo configuration, Two changes, add env_keep and append
/home/ubuntu/.local/share/gem/ruby/3.2.0/bin to secure_path under the line
of Defaults env_reset:

Defaults        env_reset
Defaults        env_keep +="RMATE_HOST"
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/ubuntu/.local/share/gem/ruby/3.2.0/bin"

Now, restart your shell, logout/login works fine. Now open (as an example):

sudo -E rmate /etc/nginx/nginx.conf

sudo -E does the trick! -E keeps environment variables which are defined
in env_keep.

Thats all! Keep the TextMate spirit alive! (macOS only)


This content originally appeared on DEV Community and was authored by Uğur "vigo" Özyılmazel


Print Share Comment Cite Upload Translate Updates
APA

Uğur "vigo" Özyılmazel | Sciencx (2025-10-03T17:00:00+00:00) rmate with sudo. Retrieved from https://www.scien.cx/2025/10/03/rmate-with-sudo-2/

MLA
" » rmate with sudo." Uğur "vigo" Özyılmazel | Sciencx - Friday October 3, 2025, https://www.scien.cx/2025/10/03/rmate-with-sudo-2/
HARVARD
Uğur "vigo" Özyılmazel | Sciencx Friday October 3, 2025 » rmate with sudo., viewed ,<https://www.scien.cx/2025/10/03/rmate-with-sudo-2/>
VANCOUVER
Uğur "vigo" Özyılmazel | Sciencx - » rmate with sudo. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/10/03/rmate-with-sudo-2/
CHICAGO
" » rmate with sudo." Uğur "vigo" Özyılmazel | Sciencx - Accessed . https://www.scien.cx/2025/10/03/rmate-with-sudo-2/
IEEE
" » rmate with sudo." Uğur "vigo" Özyılmazel | Sciencx [Online]. Available: https://www.scien.cx/2025/10/03/rmate-with-sudo-2/. [Accessed: ]
rf:citation
» rmate with sudo | Uğur "vigo" Özyılmazel | Sciencx | https://www.scien.cx/2025/10/03/rmate-with-sudo-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.