How to run mysqldump under XAMPP on Mac OS - macos

I want to run the mysqldump command in Mac OS, I am able to find the location of the file as "/Application/XAMPP/xamppfiles/bin".
But don't know how to exec the same from command prompt, as it says command not find, by simply typing it and executing it from the prompt/

The trick on *NIX systems when executing things is that you have to tell the shell exactly where the file is, or it must be in your $PATH.
This should work:
/Application/XAMPP/xamppfiles/bin/mysqldump
This would also work:
cd /Application/XAMPP/xamppfiles/bin/
./mysqldump
If you want to make it so you can just type the command without giving the location, add it to your PATH variable:
export PATH=$PATH:/Application/XAMPP/xamppfiles/bin
And then just run it!
mysqldump

Also on Mac you can simply drag and drop the file from finder right into the terminal. This will automatically type the path for you.

Related

How to run zookeeper.sh file in windows

I am following this tutorial where i have to run this command in order to start the zookeeper server.
./bin/zookeeper-server-start.sh config/zookeeper.properties
But the problem is this command is not working properly. I found that .sh file is bash file that required cygwin. I have installed it and then run command like this
C:\cygwin64\bin\bash.exe ./bin/zookeeper-server-start.sh config/zookeeper.properties
But it is showing:
I can confirm that in bin directory the file is exsits. what i am doing wrong?
Here is my directory snapshot from where i running the command:
Note: I have successfully tested bin/windows zookeeper bat file but i want to run it through .sh file as the kafka security tutorial which i am following using this.
From your screenshot, I conclude that you are using Cygwin. So, please add the cygwin tag to your question.
As you can see from the error message, the command dirname is not found by bash, so assuming that your Cygwin installation is not broken, I assume that the PATH is not set correctly; in your setup, dirname.exe should be in C:/cygwin64/bin (please verify this).
Your usage of bash.exe is a bit unusual in that you run it directly from a Windows cmd prompt. The more common way would be to use it from the 'Cygwin Terminal', which you get created a Windows-link to, when installing Cygwin, or to use another suitable Terminal program; I'm using for instance mintty for this task (also available via the Cygwin installer).
Having said this, it is possible to run bash.exe in the way you are doing it, but you then have to ensure, that at least the PATH is set up correctly. One possibility to do this, is to add C:\cygwin64\bin to your Windows PATH, but this has the drawback, that some commands have the same name in the Windows world and in Cygwin, though they serve a completely different purpose, and this will bite you sooner or later. Another problem is that at some point, you will rely on other bash specific setups besides the PATH.
A better way to accomplish your goal is IMO to ensure, that the system wide bash-initialization files are sourced by bash. If I have to run the script from a Windows cmd prompt, I would run it by
C:\cygwin64\bin\bash.exe --login YOURSCRIPT
This will read the file (in your setup) C:\cygwin64\etc\profile before running YOURSCRIPT, so you can check, that the PATH is correctly set there, by looking at this file. In a default installation, this should be the case.
After having read this file, it will try to read the file .bash_profile in your Cygwin HOME directory, so if you need additional settings for your (non-interactive) bash-scripts, create this file and put your settings there.

Terminal not recognizing vim as a command, batch file etc

So I was watching a tutorial on laravel and the tutor in the vid enters the command on the terminal as shown in the picture. He said we can use touch command on mac but to keep compatible on windows he's using vim. I don't believe he has vim.exe on his laravel project folder. Project name is freecodeGram as in pic. How do i get my computer to understand the vim command. Thanks in advance, I'm on windows.
Command was: vim database/database.sqlite
You need to add the path to vim.exe to your system PATH. This would allow you to type vim ..... in the CLI and would execute vim directly. Otherwise, prefix vim database/database.sqlite with c:/path/to/vim database/database.sqlite

On Mac OSX how can I associate a script file with Terminal so double clicking the icon launches Terminal?

I have a python script that I can run in the usual way using Terminal. For example, launch Terminal, cd to the directory, then type ./xxx.py where xxx.py is the name of the file that contains the script.
Now I want to make an icon on the desktop that launches Terminal and runs the python file when I double click it. How do I do that? I thought I could make a shell file with the cd and the launch command and then associate that shell file with Terminal. But I can't seem to associate it with Terminal.
Somebody said to name the shell file with the suffix '.command' but that causes it to launch Flash Builder. I don't know where that associate is set. I can't manually associate Terminal because I can't find it. It isn't in /Applications.
On your Desktop you coul create a file with the following content
#!/bin/bash
python PATH_TO_YOUR_PYTHON_FILE
Then you must make it executable via
chmod u+x FILE_ON_DESKTOP
Alternatively you can create a symbolic link to your python file and make it executable.
You can find Terminal in /Applications/Utilities

Explanation Bash Command ${PATH}:

To make shortcut for command line function to make it available everywhere in my mac i usually add this line in ~/.bash_profile
To include one terminal execution file, i usually use: alias yiic='~/Script/Yii/1.1.13/yiic'
yiic is terminal execution file.
And then now i have example this from another site: export PATH=${PATH}:/development/sdk/android-sdk-macosx/tools
I understand this command like import all execution file in tools directory, but what is the meaning of ${PATH}: ?
${PATH} is the other folders that your computer will look in. It's automatically set up by your OS. If you do the following command in your Terminal, you'll see all the folders your computer looks in:
echo $PATH

OSX: Environment variables pointing to application bundles?

I want cscope to open files in MacVim instead of vim, so I'm trying to have the path to MacVim as the Value of the EDITOR environment variable which is used by cscope:
$ export EDITOR=/Applications/MacVim.app/Contents/MacOS/MacVim
If I'm now trying to edit a file from within ctags, it won't work and throws this error message:
$ MacVim[8384:10b] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting
Calling MacVim from the commandline with
$ /Applications/MacVim.app/Contents/MacOS/MacVim
works, though.
How can I fix this?
Make sure you put the mvim script in your path, and try this out:
export EDITOR="mvim -f"
This was the ticket for me when using MacVim as editing git commit messages.
Have you tried export EDITOR=/Applications/MacVim.app?
Or wrapping MacVim in a small script that uses open to start the app?
It works fine for me when I set my EXPORT variable to exactly that, and start a git commit. What are you using that's calling it? Have you considered setting EXPORT to point to the mvim script that comes on the MacVim disk image instead?
<plug>
My launch tool is designed for this. It's like Apple's open, but allows you to get the path to an application bundle rather than launching it. For example:
% launch -ni com.apple.safari
/Applications/Safari.app
launch is in Fink and MacPorts too.
</plug>

Resources