zsh (Default PATH?) messed up with mongodb installation - mongodb

seems to be imposible after hours and hours trying to solve this problem. All my sudo terminal commands are corrupted due to a several path changes, so i ask for help to set the correct environment variables.
Recently I've a failed installation of mongodb, it was my mistake cause the installation was set for mojave and i've changed several times the path (currently in Big Sur).
The problem starts when i created a .bash_profile in my home user folder, with the mongodb installation path after i moved the files .tgz to /usr/local/mongodb.
After i realized that, i note that when i run sudo 'something' in terminal nothing happens. Instead the name of the window in terminal changes from .zsh to 'sudo' 40x60 and nothing happens. This is very bad for me. Appends all of this i've installed the brand new 11.3.1 big sur update and everything crashes sum the fact that every single file is veryfying...can't at least disable gatekeeper via sudo.
In my user home folder i've:
.bash_profile: - export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
.zprofile -
#Setting PATH for Python 3.9 #The original version is saved in .zprofile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
&
.zshrc
with nothing inside, empty lines.
Someone could please provide me the correct paths and commands for each of these files.
I'm only want to have sudo commands again.

Related

Can't install neovim in windows

I want to have neovim. I installed it with choco install neovim in the PowerShell (admin). Then I followed a lot of tutorials, like the one of theprimeagen, but I can't get pass the first steps. Maybe is because I don't have Linux, as everybody does, but I don't think is that.
I created a folder like so: C:/users/myusername/.config/nvim. Then, in this folder I type nvim . to open the Explorer of neovim and start creating the .lua files. The problem is that I always get a stupid .nvimlog every time I enter neovim, I think is the reason why I can't install plugins correctly or remap some keys.
In the .nvimlog every time I enter neovim appears a new line that says:
ERR 2023-02-12T12:55:04.800 nvim.15716.0 terminfo_start 374: uv_tty_set_mode failed: invalid argument. And I swear I followed every tutorial in the exact way, and even without creating any file the .nvimlog is always there.
In windows, the default config directory is ~/AppData/Local, based on their official documentation. I don't know if there is a way to change that, but that is how i configured it.
To find out where your config directory is you can also use :echo stdpath('config').

How to undo after running sudo code . --user-data-dir='.'?

I was doing the VSCode configuration, but accidentally I saw this command line which I am not sure what it is doing.
However, after running, it always creates the cache data whenever I start my VSCode.
Note: Whenever I typed this command in any directory, it'll automatically shown those folder and file in that directory.
By setting --user-data-dir you're telling VS Code where it should keep your user / session data, which is why it's creating all of those new directories. This is necessary because when you run code as sudo, it doesn't know where your user data directory is, since you're running as a different user. Like this answer says, you probably shouldn't be running code with sudo: VSCode - what exactly --user-data-dir is specifiying. See that answer for suggestions on alternatives.
As for deleting the data it made, just a simple sudo rm -rf <dir> should do the trick (be careful of course).

On MacOS Monterey 12.5 all IDE terminal sessions open at $HOME in stead of project root

As usual, not sure what caused the problem. Started laptop as usual.
But now every project i open, opens in $HOME directory instead of start directory, which is project root by default.
Tried vscode, webstorm, intellij - results were the same.
Further investigation have shown, that dragging absolute path to the terminal + enter causes following error:
zsh: permission denied: /Users/<MyName>/Code/Local/Rust/http-server
I have full read/write permissions, i added FullDiskPermissions to all apps that might need them.
Apps with full disk permissions:
I know it sounds like a minor issue, but i code every day and it's really annoying.
It's not actually an answer, i still don't know what solved it. But i somehow managed to resume the old behaviour.
The problem was global, terminal was opening in the wrong path everywhere, even from the Finder.
I reinstalled zsh, oh-my-zsh, volta (node.js version control tool) - so make sure to check if you have any of the following installed.
And after a day torture it suddenly started working as it used to.

Recipe terminated with fatal error: spawn latexmk ENOENT

I have just installed debian 10 as well as vscode. I have been struggling with this for 3 days now.. I installed texlive from terminal with the following command:
sudo apt install texlive
I then installed the latex workshop extension in vscode and tried building a .tex file. The following error popped up:
Recipe terminated with fatal error: spawn latexmk ENOENT.
I then preceded to install latexmk from terminal with:
sudo apt install latexmk
The same error kept popping up after that. The output showed this.
[14:59:34] Recipe step env: {}
[14:59:34] cwd: /home/phoenix/Documents/stellies/year4/2021/s&s-414/pracs/prac-4/report
[14:59:34] LaTeX build process spawned. PID: undefined.
[14:59:35] LaTeX fatal error: spawn latexmk ENOENT, . PID: undefined.
[14:59:35] Does the executable exist? PATH: /app/bin:/usr/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/node/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/cargo/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/python/bin
[14:59:35] The environment variable $SHELL: /bin/sh
I then proceded to review the texlive website. I noticed that i did not set the path variable to include the texlive binaries. The texlive website gives the following path to the binary files : PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
however /usr/local/texlive does not exist on my system for some reason. Where can i find the correct path to the texlive binaries on Debian 10?
I had the same problem. The root cause was: (1) software's bin folder missing from PATH; (2) bad file privileges. Consequently, VSC couldn't access latexmk, which explains the error messages.
In my case, the problem occurred on a mac, and specifically after I installed MacTex, which, in turn, installs Tex Live. I believe the same solution may apply to linux distros too.
Solution:
Claim file ownership (which was originally root) under folder /usr/local/texlive: sudo chown -R <username> /usr/local/texlive, where <username> is the OS-level user name. The fix will work for this specific user. If it is not enough, try instead setting group owner appropriately, and/or consider Step 3.
Add /usr/local/texlive/2021/bin/<software_dialect> to PATH. <software_dialect> depends on the installed software version: in my case it is universal-darwin; on linux it might be x86_64-linux.
If the problem persists, try to change file access permissions under /usr/local/texlive using chmod.
EDIT: As a final step, restart VSC for changes to take effect.
I recently encountered the same problem on MacOS Monterrey (M1 based). I used basictex (just for the context). As required by the installation instruction,
I added TeXLive to PATH,
installed latexmk package to the TeX distribution.
However, still got the same error as OP.
Afte reading the wiki again more carefully, what finally worked for me was as simple as restarting VS Code and MacOS. Everything works as expected after a reboot of the MAC.
I had this same problem on Mac recently, the fix that worked for me was to uninstall and reinstall the LaTeX Workshop extension.
I got the same issue , seems to be a misbehaving from Vscode on MacOS
check if the command is in the path on mac
-which command_you are running example which latexmk
If this output something that means you have your latex installed, otherwise go and installed it and make sure it is accessible via command line.
If latex is installed and you are getting that issue you can just restart your VSCode and everything will be okay.
Had a similar error and came across this post when looking for a solution.
I wanted to use texlive on Vscode with WSL2 on Windows 10. Installing texlive-full in wsl fixed this error for me.
On Mac, this is a way to fix the issue
Step1: reinstall mactex by downloading it from this link: http://www.tug.org/mactex/mactex-download.html
Step2: In your terminal do cd /usr/local, you should see texlive folder
Step3: In your terminal do sudo vim etc/paths to set the environment. Details are in this link: https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/
Step4: In your terminal do /usr/local/texlive/2021/bin/x86_64-linux at the bottom. check the folder to see if the year is correct. Details in: http://www.tug.org/texlive/quickinstall.html.
Step5: Quit VC code completely, and reopen it.

Mac OS: How do you fix a PATH to reach an executable file (in this case postgresql & netlify-cli) without messing up other paths?

In the mac terminal:
Does anyone know how to set the path variables for a Mac OS, without messing up other paths?
Current folder structure:
/
/Applications
/[a lot of applications]
/Postgres.app
/Contents
/Versions
/12
/bin
/psql
/Users
/userName
/Applications
/[nothing, except a couple hidden files]
Right now, if I run the command psql, I am getting:
command not found
If I type the full path:
/Applications/Postgres.app/Contents/Versions/12/bin/psql
it works, but typing this every time is not practical.
If I run git that command is available, or code .
Also, I installed netlify-cli globally with npm install -g netlify-cli, but when I run netlify-cli, I get:
command not found
and I don’t know where to find it in my system
… So, something is working correctly with my paths, and something is not. I don’t know how to fix the problem, without messing up other paths.
Does anyone know how I could find out where netlify-cli got installed and fix my paths to netlify-cli and psql without messing up any other paths?
For Mac OS to be able to find the psql executable, it has to be part of the PATH environment variable, you can check the value of that variable on your terminal with this command
echo $PATH
what you should do is add the psql executable to it, like this:
export PATH=/Applications/Postgres.app/Contents/Versions/12/bin/:$PATH
if that solves your problem, you can put that on your .zshrc or .bashrc to make it persistent