How can I find an old copy of my .bash_profile file? - macos

I accidentally ran a script that changed how my terminal (macOS Sierra) looked by completely changing all the code in .bash_profile getting rid of the Python paths as well. I would like to know if it is possible to find the previously saved version of .bash_profile so that I can revert to it.
EDIT: I had been looking at the hidden files in my home directory when I noticed that Anaconda had made a backup file: .bash_profile-anaconda.bak that had most of all of my code at the time I installed Anaconda. It may not solve all the problems but it partly works. Thanks Gordon Davisson for mentioning Time Machine as I didn't consider that even though I backed up my computer the day before.

No copy of .bash_profile is made. You need to find in backups if you have any.

Related

failed to run '/usr/bin/bash': no such file or directory

I've been using gitbash these past few days and it's working just fine. But a while ago, after install a pdf reader with patch file, when I opened my gitbash it gave me the error which says "Failed to run '/usr/bin/bash': No such file or directory". I don't know what happened and why, but I think the patch file of the application that I installed has something to do with it. My pc antivirus prompted a warning, and I took actions. Then the trouble in the gitbash happened. Please help me, I don't want to reinstall gitbash again coz I also have to install some things.
Had the same issue, searched for it, this is one of the first few results. So if you are looking why you got this message recently: check your antivirus and that the folder and the file actually exist. As previous answers mentioned, reinstall helps bring it back, but antivirus might break it again. So I would check your antivirus GUI and see if you can restore it and add an exception.
Mine was that Avast antivirus classified it as 'IDP.Generic' threat (weirdly only when I would close the shell with ctrl+c or ctrl+d on Windows 10).
to resolve this issue simply reinstall git.
I disabled Avast antivirus software
Then uninstalled and reinstalled git
It worked for me:)
Like jack this was caused by my virus scanner(avast). To resolve I opened the quarantine page restored and added exemption.
Try 'echo $PATH' in CygWin Terminal to get the PATH it must written something like
/usr/local/bin:/usr/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program
Files/TortoiseHg:/home
Depending on the Chroot in you sshd_config it looks for the /bin/bash file
you will have three options
you might have to copy the files into the Chroot mentioned folder and give the permission.
You can update with you Chroot
Or bind mounting would also help
ref
To resolve this issue simply deactivate your antivirus while reinstalling git.

Windows path/environment variable doesn't change for vim

When I write vim in powershell or cmd it say that "path/to/my/old/portable/vim80/vim.exe" does not exist. I have removed that vim long ago and have deleted its path from path variable.
I tried adding the path of the new portable vim to the path variable, but Windows still somehow finds the old path. I can't for the life of me figure out where Windows is reading that path. I looked under registry too to no avail. Even ran Ccleaner on the registry and still the problem persists.
Any help is appreciated.
Thank you very much
TLDR; Somehow windows cannot forget the path of my old vim. I added the new path, but still it picks up the old one, how do I replace the old path? How is windows still finding the old path?

get vim working in mobaxterm

I have installed gvim and vim in mobaxterm 8 (using apt-get and mobapt respectively), and can't get either to work. nano works fine.
When I run the program, the cursor moves to a new line in the terminal but nothing happens.
I have also tried creating a .vimrc. Does anyone have any ideas? Thanks.
I installed the latest version of MobaXterm as up today which is 9.1 (http://mobaxterm.mobatek.net/download-home-edition.html) and the list of bug fixes includes the freezing problem you are are talking about. It works for me now and I no longer see that issue. The only thing is that after the installation is completed you need to download the CygUtils plugin and copy it to the same folder where the MobaXterm executable is located and then restart the application. It seems overall more stable now. Hope that helps.
I am using V9.4 which already has the vim. To configure the environment for your vim you may creat a .vimrc file in your home directory (go to the directory using cd command only).

Sencha Touch Cmd tool 3.0 install not working on Mac

-bash: sencha: command not found
I just spent a few hours trying to make this Sencha Cmd works on my MacBook, but just couldn't. I uninstalled a previous version and just couldn't get it to work again. I always get the
-bash: sencha: command not found
error. I did try everything in this post, without success.... I even get an error when I call
.bash_profile
stating that it's not found... Do you have any idea what could be the problem ?
I'm fairly new to the Linux command world so I might miss a point here. Maybe I might use "sudo" to be granted acces to bask_profile ?
EDIT : I got it working for the current bash session. I position myself at the user root (~/) and call ". .bash_profile"(the space is important here). BUT... it only works for the current session. As soon as I close Terminal and reopen it, I loose everything :-(
OK, just so you know, I managed to fix the damn thing be opening and editing the ".bash_profile" file in a text editor (TextMate for me). This is an hidden file, but you can configure your Mac to show those files in Finder. The file is located at your user's root. It is quite annoying to have to spend hour messing in path and environment variables in 2013... Installer should do those things and reports error if something happens in the install process.

EPD Python vs System Python--OSX Mountain Lion 10.8

I'm a two week old mac user, so bear with me here. I'm trying to set EPD python up as my default python interpreter instead of the system python that came with the mac. It was my understanding that EPD does this automatically upon installation by modifying the .bash_profile, but after I installed EPD, the .bash_profile was unaltered and as far as I can see, system python is still the default interpreter. How do I go about changing this?
The major reason why I want to change the default python to EPD is that all the packages I install are automatically placed into the /Library/Python/2.7/site-packages directory instead of the site-packages directory associated with EPD. In particular, I can't get PyCuda to install in EPD's site-packages directory.
I hope this made some sort of sense. I'm lost and not sure where to go from here. Help is greatly appreciated.
Adding the line
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
to your .bashrc file should work.
In theory the EPD installer should have done this job... maybe an issue with permissions?
A few additional points.
Normally the EPD installer makes the PATH changes by adding lines to the bottom of ~/.bash_profile ; if you are sure that it did not, you can also check ~/.profile .
Perhaps you installed EPD as a different user?
Since you say that you are new to Mac, I'll also mention that the PATH would not have been changed in any terminal windows that had already been opened before you installed EPD.
Also, a crucial warning: since you've already installed 3rd-party packages into your system Python, please see this article:
https://support.enthought.com/entries/22094157-OS-X-Conflict-with-installed-packages-in-earlier-Python-installation
You may also find other useful articles in that same Knowledge Base site.

Resources