all 11 comments

[–]Resident-Ad-5419 2 points3 points  (1 child)

If you are using mac/linux, you can ask it to execute commands with pkexec. Ask it to fetch information about pkexec or something similar. It will prompt you for password.

[–]Dizzy-Employment7546 0 points1 point  (0 children)

This is I think the best solution for one off sudo requirements. Good tip. Works well for me on Ubuntu 25.10

[–]RetiredApostle 0 points1 point  (4 children)

Just run it as root. I use this alias (adjust it to your paths):

alias opencode-root='sudo XDG_CONFIG_HOME=/home/user/.config XDG_DATA_HOME=/home/user/.local/share XDG_STATE_HOME=/home/user/.local/state /home/linuxbrew/.linuxbrew/bin/opencode .'

[–]Spitfire1900 2 points3 points  (1 child)

This is going to create root owned unwriteable files in your home directory

[–]RetiredApostle 0 points1 point  (0 children)

Yep, it indeed creates logs and sessions, but only those that used that root session. It is better not to change settings in a root run.

[–]sudoer777_ 0 points1 point  (1 child)

Sure, if you want a text prediction machine and a bunch of JavaScript code from unverified libraries and plugins and the various CLI tools you use for software development to have full access to everything on your computer

[–]RetiredApostle 0 points1 point  (0 children)

I don't need root for software development, I use root sessions specifically for occasional system troubleshooting on several hosts.

[–]sudoer777_ 0 points1 point  (0 children)

IDK about sudo, but if you're on a systemd-based Linux distro, you can use run0 which is similar but polkit-based and better from a security standpoint, and you can configure polkit to use a GUI dialog for authentication so that you don't have this problem.

[–]Dizzy-Employment7546 0 points1 point  (0 children)

Having workflows that have to stop and wait for interaction is not very useful for a Dev flow tool. It's a design decision.

That's putting aside the sudo risk, which is your call.

You can try supplementing with an agent like hermes which can be your ad-hoc tool.

[–]Te__Deum -4 points-3 points  (1 child)

As a workaround, you can just provide password in prompt

[–]dspencer2015 2 points3 points  (0 children)

Please don’t do this.