How to export everything useful in my iTerm to another system - macos

I am currently using iTerm2 3.4.4 on my macbook pro. I am getting a different macbook and would be installing iterm on that one as well.
I want to export as much as possible from the older machine and import it into the new one. Some things I can think of it profile settings, command history, etc. How can I export these things and import them in the new machine ?
Is there an iTerm folder I can just copy and paste ?

You can export your profile by going to Settings - Profiles, then go to other actions and then Save Profile as JSON. You could copy the whole /Users/yourusername/Library/Application Support/iTerm2 folder to your new machine, which probably works as well. The command history depends on the shell that you're using, it has nothing to do with iTerm.
Bash History: ~/.bash_history
Zsh History: ~/.zsh_history
Fish History: ~/.local/share/fish/fish_history
The shell configurations depend on your shell as well.

Related

oh-my-bash not launching at terminal startup

A little while ago I updated to the newest version of bash on my macbook (all went smoothly there,) and decided to try out the oh-my-bash framework. I had previously used oh-my-zsh, so I was familiar with the installation; however, I'm running into an annoying problem with oh-my-bash.
When I open the terminal the framework doesn't launch automatically. It only launches if I run exec bash in the command line. I've checked in system preferences and bash is set as default, and running bash --version confirms that I am running the correct version of bash when the terminal starts up.
It's more of an inconvenience than anything else, but I'm learning scripting and my burning curiosity wants to find the solution. I'm out of ideas short of a fresh install of the framework; what do you guys think?
My solution is this:
Run this code in terminal
mv $HOME/.bashrc $HOME/bash_profile
Restart your terminal
In linux, bash run command file is .bashrc, but in MacOS is .bash_profile.

Will I lose my environment variables if I upgrade to macOS Catalina?

I've heard that it's best to wait after a new OS comes out until a few updates come in so that the build is a bit more stable. However, I'm also wondering if I will have to set up my environment, PATH, etc again after upgrading. Will updating change anything or will everything be the same as before?
(I'm currently on macOS Mojave 10.14.6)
One thing to note is that environment variables can live in different places, so it may depend on which ones you're referring to.
Usually if Mac OS upgrades need to change a file that you're likely to customize, like the httpd.conf file, they'll make a backup first. But there's no guarantee; it's good to keep a Time Machine backup handy from before you upgrade. With that you can copy in anything that got lost.
Also note that Catalina is switching the default shell from bash to zsh, so if you have environment variables in .bash_profile or .bashrc, those will be ignored. You can switch back to bash if you want, or configure zsh with similar settings.
Starting with macOS Catalina -- by default it takes zsh and hence you need to change in zprofile. Please follow below steps
touch ~/.zprofile; (// This will create the profile)
open ~/.zprofile; (Open this in an editor)
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.11.jdk/Contents/Home
export GRADLE_HOME=/Users/myuser/Documents/installs/gradle-6.8.3
export PATH=$PATH:/Users/myuser/Documents/installs/gradle-6.8.3/bin
source ~/.zprofile (Execute the new .zprofile by either restarting the terminal window or using this)

After updating my Mac OS to Catalina, Flutter is not working anymore in Android Studio. I deleted and re-installed, but still not working

Please Please help. After updating the OS to Catalina, Android Studio would still open, but none of my Flutter apps will work and the emulators do not open (they say 'Loading')
I unistalled Flutter and re-installed it, but in the Terminal when I type in flutter doctor -v, it says "zsh: command not found: flutter"
Is this because I'm no longer using bin (or bash), and now using zsh?
Can someone tell me what I can do to solve this issue? Im not very good at entering Terminal commands, so what exactly would I type to fix this issue? (I'm a beginner)
When I was entering vim bash_profile in the Terminal, I entered the following as the Export Path:
export PATH="$PATH:/Users/raymondfontaine/Developer/flutter/bin"
I had the same problem and it occurred after switching from bash to zsh. A far as I know, you have three different options.
Switch your Terminal back from zsh to bash by typing chsh -s /bin/bash and restart your Terminal. Note: You can always switch back to zsh by typing chsh -s /bin/zsh and restarting your Terminal.
You can tell zsh to use the paths specified in your bash_profile file by typing source ~/.bash_profile into your Terminal. Note: You have to do this every time you open a new Terminal.
The two options above are probably not "Best Practice". The best solution would be to set environment variables for zsh as suggested by the flutter Tutorial: Update your Path.
In your case you have to type nano $HOME/.zshrc into your Terminal enter export PATH="$PATH:/Users/raymondfontaine/Developer/flutter/bin" there, save the file and restart the Terminal. After that flutter doctor -v should run as usual.
Also the emulators in Android Studio should load again. But if you still cannot start them via the Dropdown, try opening them via Tools > AVD Manager. This worked for me while they were not visible in the Dropdown Menu.

How to open a window from mac terminal

this is the first time I ask on stackoverflow because I can't find the answer anywhere. I use emacs to write all my code and I just switched from ubuntu to mac os. One problem has been bothering me: How could you open emacs window from mac terminal just like you would open firefox window from terminal on Linux system? I know the way it works for Linux system is that, whenever you type a command from terminal, the terminal search for the binary in you PATH and execute it. Is it the case for Mac that you can only open applicaiton in window form under "/Application" directory and all binaries opened from terminal are in non-window form? Big thanks!!
The pre-installed Emacs that comes with OS X is built without the GUI. Hence
$ emacs # in the shell/terminal
will NOT open a graphical window, and instead will open up the text/terminal version instead. Note that this version (installed at /usr/bin/emacs) is also old, and is at 22.1.1 in Mountain Lion.
To get the behavior you desire (and also get the latest version of Emacs as a bonus), you can download the latest Emacs build. This is available at various places, including http://emacsforosx.com/.
Most of these pre-built Emacs are installed under /Applications, and in order to invoke from the terminal, you will need to specify the full path to the binary, which usually is:
/Applications/Emacs.app/Contents/MacOS/Emacs
You can create a simple alias to this binary in your .bashrc as:
alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs
and then invoke emacs in its full glory from the command line.
I just tried
/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal &
and it did open a new window just fine.
OS X 10.7.4 here.
EDIT: Indeed if I try:
open /Applications/Utilities/Terminal.app
No new terminal window is opened
But,
open --new /Applications/Utilities/Terminal.app
works also, and is probably better than my first option because the job is not tied to the terminal you started the new terminal with.
First, download a Mac OS/X emacs build from here: http://emacsformacosx.com/
Second, once it's installed, you can:
Open it from the command line with open -a emacs
Set it to run server mode in your .emacs init, and then at the
command line type emacsclient foo for file foo.
I'd recommend either getting emacs via fink, or going to here: http://emacsformacosx.com/
This will allow you to install a local version of emacs that runs through the X server, and thus has the full GUI interface.
not sure if u're looking for something like this
open /path/to/some.app

VIM Flashing Issue

I'm SSH'ing in from my mac OSX (10.6.8) to a school server running centOS5 and when I attempt to use VIM, it won't stop flashing inside the mac terminal. Any idea's on how to fix this? Keep in my mind I do not have the authority to modify any /etc files or /bin files on the server, although I believe I can locally on my user. Also I would love to see anyone's really cool .vimrc config file they want to share.
Try these out:
set visualbell t_vb= " turn off error beep/flash
set novisualbell " turn off visual bell
Though the link may go stale in the future, for the time being this is the source: http://phuzz.org/vimrc.html
I also know that you can set this via terminal options on the MAC, though this is not likely the issue if you are ssh-ing. Anyway, I hope it helps. Good luck! :)
I´ve just had the same issue.
I solved it by disabling the setting "Allow blinking text" in the terminal text settings as shown in this
screenshot.
Regarding .vimrc config there are tons of versions to be found on google, especially github is a good place to go.
to stop beeping & flashing in both the console & the GUI versions of Vim try:
set noerrorbells visualbell t_vb=
autocmd GUIEnter * set visualbell t_vb=
I was pretty frustrated with macvim installed via brew.
First, on installation, it had an issue with the python version.
I did upgrade brew and python. Then I started macvim but it was flashing really bad, to eliminate, I had to ***disable core text renderin***g under preferences -> advanced options.
Finally, it got stable but couldn't open files or tabs.
objc[80401]: Class FIFinderSyncExtensionHost is implemented in both
/System/Library/PrivateFrameworks/FinderKit.framework/FinderKit
(0x10d099200) and
/System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride
(0x115309c00). One of the two will be used. Which one is undefined.
So I decided to get rid off it altogether.
brew uninstall --force macvim
Installed it manually from here.
Once installed, I used the following command to create an alias. Add the following line to your .bashrc or .zshrc (for iTerm users).
alias mvim=/Applications/MacVim.app/Contents/MacOS/MacVim -g
Now reload your terminal session and type mvim. Enjoy!!

Resources