How to disable/remove Terminal script? - macos

A while ago I wrote a Terminal script that executes cd Desktop every time I start Terminal.
With the release of Lion, this is no longer necessary as Terminal remembers where I last left off. I can't figure out how to disable/delete the script because I can't find it. There are also no options in the Terminal preferences that can help me. How do I disable or delete this script?

Probably controlled by one of the following files in your home directory, which you can edit/delete to remove this behavior:
.bashrc
.bash_profile
.profile

Related

Opening a project directory in PhpStorm from the Terminal

I want to open a project directory in PhpStorm using pstorm .
I am aware that there are many threads that have discussed this issue, but I have not been able to completely solve my problem with the solutions from those threads.
Using the IntelliJ Toolbox, I click the gear icon (top right) and I enable the Generate Shell Scripts option. I set the Shell script location to /usr/local/bin (which is in my PATH). The Shell Script Name is specified as pstorm.
The first issue is that the script isn't generated in /usr/local/bin. Presumably since the Toolbox doesn't have write privileges at that location. I then set it somewhere where it has write privileges - something like /home/username/.local/share/JetBrains/Toolbox/bin. The script is successfully generated there under pstorm:
# Generated by JetBrains Toolbox 1.20.7940 at 2021-03-24T16:55:42.325644
"/home/username/.local/share/JetBrains/Toolbox/apps/PhpStorm/ch-0/203.7148.74/bin/phpstorm.sh" "$#"
I then copy that file to /usr/local/bin: sudo cp pstorm /usr/local/bin
I then open a terminal and navigate to my desired directory, opening said directory in PhpStorm with pstorm .
PhpStorm then opens the directory. However, PhpStorm is then 'locked' as a child to the (parent) terminal instance and closing the terminal also closes PhpStorm. A more complete explanation relating to this behaviour is given here
I would really prefer that PhpStorm not be dependend on a terminal instance, much like when I run code . for VSCode.
Any ideas why it is doing this and how to 'solve' this behaviour?

How to reset that open vim with a clean window in mac's terminal

I encounted a problem after I change the syntax of mac's terminal vim. Right now, when I open vim, it just shows up under many line's of my shell command (screenshot below) instead of like before open a clean window and cannot see my shell command. So how can I reset it back that open my vim that in a clean terminal window?
Finally find out that because of the TERM is not set to xterm, so I fixed this issue by adding export TERM=xterm-color in my .bash_profile file. If you have the same issue, hope this would help.

Appearance of a tilde(~) in mac OSX terminal in the path

I am new to the Mac OSX environment, and was programming in C using the terminal. To change the current directory, I used the command cd .. to go one level up. However, this had a weird effect on the terminal. A clear screen on my mac terminal normally used to show this path always-
manishs-mbp:manishgiri$
However, since the time I did cd .. (to go one level up), the current pathway of the terminal has changed to:
manishs-mbp:~ manishgiri$
As you can see, there is a tilde now in the pathname. On reading about it, it looks like this tilde is used to represent the home directory in mac os. However, i would like to get rid of it, as it was earlier.
I tried to think of it, and realized that cd .. would have taken me one level up. So, I entered pwd in the terminal to see the current pathway(this is with the tilde situation), and got this-
manishs-mbp:~ manishgiri$ pwd
/Users/manishgiri
Maybe the tilde appears because I am now by default in the /Users(Home) folder. If that's the case, then how do I revert it back to the previous settings to get rid of the tilde?
Any help on this would be highly appreciated, thank you.
Try
PS1=`pwd `
to set your prompt.
If you like that, check in your home directory for a file called .profile and edit PS1 setting permanently into there.
This may help.

Terminal app in Mac OS X Lion 10.7 stuck?

Some days ago I tried to create a shell script which would open all the torrents files in my downloads folder. I am not sure if I get the sh file written right, since then I am getting this message:
Last login: Fri May 18 22:54:28 on ttys000
LSOpenURLsWithRole() failed for the application /Users/Alex/Downloads/(Demonoid.me)-Adobe_Master_Collection_CS5_(OS_X)__12302562.8934.torrent
with error -10810 for the files
/Users/Alex/Downloads/Coda_1_6_2_[_Plist]_[Serial]_O-Demonoid.me-O_12302562.8934.torrent,
/Users/Alex/Downloads/Coda_1_7_3_[k'd]-((Demonoid.me))_12302562.8934.torrent,
/Users/Alex/Downloads/[kat.ph]grid.systems.in.graphic.design.josef.muller.brockmann.torrent,
and /Users/Alex/Downloads/[kat.ph]pixie.lott.cry.me.out.mp3.housezz.torrent.
job done
/bin/bash: line 8: end: command not found
[Process completed]
And I can't do anything in Terminal. I don't know what to do. Any insights about it?
Open a terminal and let it hang.
Open the terminal preferences menu (Command-comma).
In the Startup tab, remember your current shell setting.
Choose a shell other than Bash or Sh (e.g. /bin/tcsh — this is a desparation measure, and only temporary).
Close the locked terminal.
Open a new terrminal (Command-N).
That should give you a command prompt.
In that window, edit your .profile or .bashrc or whatever you added the Torrent lines to.
Remove the Torrent-related lines.
Go back to terminal preferences.
Reset the shell to /bin/bash.
Try opening a terminal window once more.
When it comes to trying to add the Torrents again, write a shell script. Debug it. Only put it in your profile when you're sure it is correct, stable, reliable, and doesn't lock your terminal. Then test it with a terminal already open — opening a new terminal to do the test. You've then still got an unlocked terminal you can fix problems with.
If you have a graphical Vim (Gvim or MacVim), you may be able to launch that and then edit your .profile without having to tweak the Terminal preferences.

Cygwin terminal prompt missing

Previously, when launching the Cygwin terminal, a console will popup and the line will say:
username#PCName ~ then a blinking cursor after $.
Now a blank console appears and nothing is on the console screen but a blinking cursor...
The shortcut seem to be directing to the right path "C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -" so I don't know what's going on.
How do I go about fixing this issue? Do I have to look into the Environment variables? If so what do I have to look for?
I'm running Windows XP Professional x86.
Try changing the shorcut to this:
C:\cygwin\bin\mintty /bin/env CHERE_INVOKING=1 /bin/bash -l
Since you say it starts up successfully using cmd, it could a problem starting up you mintty environment. Try going into your home directory and deleting (back it up somewhere else if you want to be able to bring it back) the .minttyrc file and then try to start up again.
If that doesn't do the trick, try to go a little bigger and do the same with the bash environment files. Back up .bashrc, .bash_profile, .bash_aliases (if you have it) and .inputrc and replace them with the default sample files that are in the /etc/skel folder, then try to restart again.

Resources