Best way to add environment variables to MobaXterm - unix

I'm just now setting up MobaXTerm on my local computer and I'm looking to see what is the best way to port over all my environment variables I have on my windows host over to MobaXTerm. The whole goal of this exercise is that I plan to not use command prompt/git bash but instead just use MobaXterm.
For example, if I go to my Command Prompt and type in 'python', I can type Python code in the command line. Now when I do this in MobaXTerm, it says that I don't have it installed. This extends to more applications so I would rather not try and manually install git,python, etc. in my MobaXTerm manually.
I've extracted a list of all environment variables on my Windows host by typing in 'set > paths.txt' in the command prompt, but I want my MobaXTerm command line to reference these when I am using the terminal there. What is the best way to do this? Is it setting it up in a .csrhc?
Edit: I tried changing the settings in MobaXterm to use the Windows PATH environment, and even when I restarted my computer I still haven't gotten it to work

In the "Terminal tab settings" section, so you will find this option in the "Terminal" tab.
Go to MobaXterm global settings window, then click on the "Terminal" tab and check the "Use Windows PATH environment". Note that if you are using a session, you will have to do the same in this session: edit your session, then go to the "Terminal settings" tab and check the "Use Windows PATH" option.

I had the same issues while trying to use git. It looks like MobaXterm keeps using his own executables located %USERPROFILE%\Documents\MobaXterm\slash\etc, and even recreates them when you delete them.
You can still force MobaXterm to use windows PATH configurated executables by launching cmd /c yourcommand, in my case cmd /c git push. It will run windows CMD command using your PATH environment variable.
You have to check "Use Windows PATH" on the "Terminal settings" of your MobaXterm session settings in order to works.

Related

Why running go env in GoLand's terminal is different from system terminal

The output in GoLand's terminal:
The output of go env in the OS terminal:
GoLand manages some of the environment variables and settings and overrides what's configured in the system so that it can create a reproducible environment between running code in the builtin terminal or when using the editor itself.
From what I can see in the images, I see that there are some differences around the GOFLAGS, GOPROXY, and GOMOD.
If I understand correctly what you are trying to do, then you need to enable the Go Modules support via Preferences | Go | Go Modules (vgo) and enable the Go Modules integration. Once you do this, you'll see that the GOFLAGS value will change.
There you can also set the Proxy field value to configure the GOPROXY environment variable.
The GOMOD difference comes from the directory where you invoked the go env command, as in this case they seem to be different directories. Invoke the command in the same directory in both IDE terminal and OS terminal and you'll see the same value. It indicates which, if any, go.mod file is used in the current command.
Finally, I recommend upgrading to GoLand 2019.3 as it will automatically enable Go Modules support when it detects that the project is created in a directory with a go.mod file present.

Why do you need to source .zshrc for every new shell in iTerm?

I've used Iterm2 with zsh everyday for the past 3 years, but I got a new computer and had to set it up again. The problem is that when I run ~/.zshrc it works fine, but I have to do it on every new terminal window I open. Not a good experience.
I noticed that I don't have any bashrc, bash_profile, or profile (dot)files on my new machine.
Here's the code in ~/.zshrc:
export ZSH=/Users/healy/.oh-my-zsh
plugins=(
git
)
ZSH_THEME="agnoster"
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
DEFAULT_USER=healy
Again, it works perfectly (and as expected), but only after I run the source command, and that shouldn't be the case.
Make sure your export/source are added after the plugins in your zshrc, as stated in this post:
oh-my-zsh config file not loading
On starting a new shell just run the command source ~/.zshrc by configuring in the
Preferences -> Profiles -> Select Default Profile(default profile will be starred) -> General -> Command -> Select Login Shell -> Send text at start:
Enter the value source ~/.zshrc.
You may add source ~/.zshrc; clear in case you need to clear the screen contents after executing the command.
I had the same issue and changing the Shells Open with option fixed this for me.
To get here:
Open Preferences for Terminal
Select the General Tab
Change Sells open with from Default login shell to Command (complete path) with the /bin/zsh in the input box.
Screeshot:
On 11.2.1 with Terminal 2.11, assuming you have already created .zshrc in your home directory, launch Terminal and select Terminal >> Preferences >> Profiles >> Shell
Under "Startup" check "Run command:" and input source ~/.zshrc
In my case, oh-my-zsh is not loaded because the line was comment out.
# IT'S WRONG! NEED TO UNCOMMENT
# export ZSH=/Users/$(whoami)/.oh-my-zsh
Though this question is not due to the same "comment out" obviously, I came to a conclusion that, if you need to source ~/.zshrc every time opening a shell instance, there should be some issue with your .zshrc,
and check oh-my-zsh and antigen(maybe) work fine.
for me,It works like this.
Profiles 》Open Profiles 》Select “Edit Profiles” 》Profiles 》General
and put "source ~/.zsh" into Send text at start textfield.

"meteor" shortcut not working over SSH

I created an admin user ("win7desktop") on my iMac. As that user, I installed meteor.js and created a project ("coolApp").
Then I went to my Windows PC and (using PuTTY) logged into my iMac via SSH as user "win7desktop". I navigated to "coolApp" and tried entering "meteor", but that gives me "command not found". I can enter "/usr/local/bin/meteor", and that seems to work.
What did I do wrong? How do I make the "shortcut" work?
It seems like your path isn't being set up properly when you ssh over!
if running:
which meteor
returns nothing (or an error), then you can run
PATH=$PATH:/usr/bin/meteor
to temporarily add it to your path. If that works out, you may want to add that above line to your ~/.bashrc file, so its run whenever your shell starts.

oh-my-zsh config file not loading

I am trying to get ZSH config working correctly on Mac OSX. I installed it using curl: curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh. Then I modified my zshrc file to fit my needs. It works only after I run source ~/.zshrc. But then if I come back and open a new tab or new terminal I have to do source ~/.zshrc to get the config settings to work again. Has anybody ran into this issue? I believe there is a way to make it so I don't have to do source ~/.zshrc with every new tab.
I figured this out. It was due to my config file. The part of the zsh config that wasn't loading needed to be moved down after the plugins load. After moving that it all worked as expected.
If you have themes like Powerlevel9k installed for your zsh shell then source the oh-my-zsh config file after the theme variable assignments in your .zshrc file like shown below.
Eg:
........
........
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=('status' 'load' 'ram_joined' 'time')
# source oh-my-zsh config
source $ZSH/oh-my-zsh.sh
Not the ideal solution but solves the issue:
Terminal -> Preferences -> Profiles -> Shells -> Startup
Check the box that says "Run command" and in the input box run
source ~/.zsh/.zshrc
This will be executed when you open a new terminal window / tab.
My final solution was to go to Terminal --> Preferences --> General --> Shells open with --> Command (complete path), and set it to /bin/zsh (or your path to zsh), and then set both New windows/tabs open with to "Same profile". It works fine for me.
My initial attempt was to go to Terminal --> Preferences --> Profiles, and in my default profile's "shell" tab's Startup section, I set it to run command "source ~/.zshrc". This also solved the problem of /.zshrc not loading, but it seemed tedious to see that command show on every terminal tab/window.
I had a similar problem. I found that I had long ago changed my Terminal preferences to run tcsh instead of the default login shell. Took me forever to figure this out!

How can I pass through text from an rlogin console to local vim in cygwin?

I have a cygwin console running on my windows box, and vim installed and working fine. But when I do an rloging to a server (rlogin server.at.com running unix) my vim command is launching the vi on my remote box. Is there a way to tell cygwin to "tunnel" the text file that I try to open in the rlogin session to a local vim session just as it does with a local file (applies also to my nedit which I dont have in the remote machine but I do in the local one)?
Thanks!
I'm not sure how or if it would work with rlogin but bcvi is SSH-based and allows you to do $ vim filename on the server and open a GVim window on your local machine.
You can also use Vim's default plugin netrw which lets you manage and edit remote files using, among other protocols, rcp:
" manage files
:e rcp://[username#]machinename/path/to/directory/
" edit file
:e rcp://[username#]machinename/path/to/directory/filename
But… is there a reason for using rlogin instead of ssh?

Resources