I have a ruby script that I run from the terminal, however I want to be able to double-click an icon like I would an application and run the script. I've looked at ruby-packer, but it isn't working for me.
What is the best option to accomplish this?
Im on a mac.
In terminal, I'm not at the directory of the .rb file because when I try to run ./rubyc from the directory containing the .rb file, I get the error command not recognized
When I run ./rubyc /RubyProjects/signOff.rb /signOff.out I'm able to get it to run, but the outfile file is called rubyc that just re-runs the same code when I double-click it. I'm at a loss for how to get it to work properly.
`
The -o parameter defines the output filename:
rubyc -o signOff signOff.rb
I want the mysql server to start on every startup of my mac. Usually I do this via the command line with mysql.server start.
Now I wanted to automate the process and for the first time I worked with Automator. So I added a "shell script", configured of "/bin/bash" and pasted the command. When I start it I'm getting a popup with an error. It's german so I cannot translate it 1:1. It says something like "An error occured during the action "Execute Shell-Script".
I'm using KDevelop.
My program creates a picture file.
So i'd like automatically open it after execution. HOw could I do this in the KDevelop??
I looked at this theme Kdevelop execute project with parameters and my run-configuration is shown at the picture.
In the KDevelop's Run Tab I got the following launch command:
Starting: /home/df/projects/topopt/build/topopt && xdg-open ~/projects/topopt/build/sample.gif
Image viewer doesn't launch. But this command is correct, image viewer launches if I type this string in the terminal .
You can create a shell script, say run.sh, with the following commands
#!/bin/bash
/home/df/projects/topopt/build/topopt
xdg-open ~/projects/topopt/build/sample.gif
Then set the complete path to run.sh in front of Executable field
Since GNU Octave comes wit a GUI since versions 3.8.0, I thought I should check it out.
So since I run Windows and could only find Octave 3.8 for Cygwin, I installed Cygwin and the packages octave, xinit, xlaunch and gnuplot (according to this page, but I don't know if all those packages are needed).
Then, when trying to start Octave with the GUI from Cygwin with octave --force-gui, I initially got the error message
octave: X11 DISPLAY environment variable not set
and Octave would start in console mode. So I found this page, which told me to run
echo "export DISPLAY=:0.0" >>~/.bash_profile
from Cygwin, to permanently get rid of the error message, which worked. However, then I instead got this error message:
octave: unable to open X11 DISPLAY
The same page also said that you have to run the X Server by going to Start -> Cygwin-X -> XWin Server. That worked, but since I don't want the xterm terminal to start since it is not needed, I found this page which told me to run
touch ~/.startxwinrc
from Cygwin to create an empty .startxwinrc file, to prevent the xtrem terminal from starting by default, which worked. The same page also mentioned that the X Server can be started directly from Cygwin with the command startxwin.
So, now I can start Octave with the GUI from Cygwin, simply by running
startxwin
octave --force-gui
However, I would like to just be able to double click on a desktop icon to get everything up and running.
So, to my question: Can I somehow put this in a script file, which when I run it, will be opened in Cygwin so that the commands in the script file will be run in Cygwin? And is there some way to automatically close the X Server after Octave has terminated? I've tried writing a file octave.bat, which starts Cygwin and gives a second batch file as argument, which in turn contains the commands I want to execute. But when I run the first script, I just get bombarded with command prompts (not Cygwin prompts), and the all say
'startxwin' is not recognized as an internal or external command, operable program or batch file.
Why is the second script not opened in Cygwin, and how can I achieve what I want as simply as possible?
Please grab Octave from here: http://mxeoctave.osuv.de/
The installer should configure everything for you.
GNU Octave offers now Windows binary itself. Go to ftp://ftp.gnu.org/gnu/octave/windows/
You have to put
c:\cygwin64\bin\mintty.exe /bin/sh -lc 'startxwin /bin/octave --force-gui'
in your windows batch file (please adapt the Cygwin path to your settings). That worked fine for me.
The call
c:\cygwin64\bin\bash --login -c "startxwin /bin/octave --force-gui"
did open Octave as desired but the GUI seemed to have response issues to the keyboard and froze after clicking into the editor.
I don't have any of the those commands installed with my Cygwin installation, so I can't test this by trying using the following an .bat file on your desktop:
c:\cygwin\bin\bash --login -c "startxwin octave --force-gui"
Replace c:\cygwin with the directory where you installed Cygwin.
If this leaves a console window on the screen try doing:
c:\cygwin\bin\bash --login -c "run startxwin octave --force-gui"
I can run a Perl program from the terminal but I would like to run a program by double clicking it on the desktop.
I've tried using Platypus to run the program but the program requires user input and Platypus can't run any program that requires user input. I have right clicked the file and went into Get Info to try to change the program the file opens with. I've also tried to run the command chmod a-x "filename" to get the program to run when I double click it but I've had no luck with that either.
Does anyone know how this can be done?
Your permissions are wrong; you need to set the file to have +x (execute permission), not -x. Try
chmod +x program
Once you give it an execute bit, MacOS should give it an icon like this
Then double-clicking it will open and run the script in your default Terminal app. (Usually Terminal.app, but you could also use something like iTerm.)