Ghostscript installed but not found RGhost::Config::GS[:path]='/path/to/my/gs' - ruby-on-rails

I've been trying for a few hours now solve this problem and I looked everywhere for a solution and I did not find one. I'm trying to run a spec test for my project and I have the following error coming up:
RuntimeError:
Ghostscript not found in your system environment (linux-gnu).
Install it and set the variable RGhost::Config::GS[:path] with the executable.
Example: RGhost::Config::GS[:path]='/path/to/my/gs' #unix-style
RGhost::Config::GS[:path]="C:\\gs\\bin\\gswin32c.exe" #windows-style
And I do try to put RGhost::Config::GS[:path]='/usr/local/bin/gs' and it returns:
bash: RGhost::Config::GS[:path]=/usr/local/bin/gs: No such file or directory
but ghostscript is installed, I did everything (make, sudo make install, etc etc) and when I run gs -v it returns:
GPL Ghostscript 9.26 (2018-11-20)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
When I use the user interface and search for "gs" in the "Files" application, it is found in /home/marcelle/projects/ghostscript-9.26/bin/gs and I also tried:
RGhost::Config::GS[:path]='/home/marcelle/projects/ghostscript-9.26/bin/gs'
and it returns the same error:
bash: RGhost::Config::GS[:path]=/home/marcelle/projects/ghostscript-9.26/bin/gs: No such file or directory
I also tried to delete ghostscript from my notebook with autoremove and purge and installed it again using what I mentioned before (./configure, make, sudo make install), restarted the notebook, the terminal and nothing.
PS: I'm using Ubuntu 20.04.

I managed to figure out a solution. Looking for the code for the Rghost, what I saw in its spec is that the path expected was different than the path the ghostscript really is.
When I run whereis or which on my terminal, it returns:
which gs
/usr/local/bin/gs
So I was trying to point to this path. But seeing the spec test for Rghost which I found on github for Rghost, we can see that it expects /usr/bin/gs:
it 'should detect linux env properly' do
RbConfig::CONFIG.should_receive(:[]).twice.with('host_os').and_return('linux')
File.should_receive(:exists?).with('/usr/bin/gs').and_return(true)
RGhost::Config.config_platform
RGhost::Config::GS[:path].should == '/usr/bin/gs'
end
So it expects /usr/bin and not /usr/local/bin.
Then I just copied to that path and the spec ran with no problems anymore:
sudo cp /usr/local/bin/gs /usr/bin

I've no experience with Ruby at all, but I also got this error when using asciidoctor, which uses rghost for the PDF generation.
The command RGhost::Config::GS[:path]='/path/to/my/gs' mentioned in the error is not a shell command, which is why bash couldn't handle it. However, to me it wasn't immediately clear what to do with this command either. I expected an easy way to set this variable somewhere, but couldn't find it.
What worked for me was searching the rghost.rb file, which is where this variable is set and can be changed. In Windows, it was located in C:\Ruby30-x64\lib\ruby\gems\3.0.0\gems\rghost-0.9.7\lib\rghost.rb.
In this file, I added the following line, which solved the problem:
RGhost::Config::GS[:path]="C:\\Program Files\\gs\\gs9.55.0\\bin\\gswin64c.exe"
NB: the mentioned paths can be different for everyone, so make sure to use that paths that are valid for your system.

Related

Apache Jena Commands not found

I'm trying to set up my system (Ubuntu 16.04) with Apache Jena 3.10.0, and followed the provided instructions, but I'm unable to access any of the commands that I should have access to.
For example, sparql --version and bin/sparql --version both return:
sparql: command not found
I have downloaded and extracted the files to /home/[user]/apache-jena-3.10.0, then run:
export JENA_HOME=/home/[user]/apache-jena-3.10.0
export PATH=$PATH:$JENA_HOME/bin
The command cd $JENA_HOME successfully goes the apache-jena-3.10.0 directory.
I feel that there is a basic linux thing here that I'm missing, but I've tried a lot of things and had no luck so far. Any help would be greatly appreciated. Thanks!
The files in the download from Apache were not marked as executable. From the main apache-jena-3.10.0 directory, chmod -R 775 bin changed all files so I could run them from command line.

Meep installation and run on Cygwin

I needed to use Meep for one of my simulations and am trying to figure out how to do it. I installed Meep on Cygwin platform as detailed in this website:
http://nikodem.blogspot.com/2015/12/installing-meep-under-windows.html
After installation, I open the cygwin bash shell and type meep, which gives me the Meep prompt : meep>
But whenever I try to run some example files provided along with the installation and stored in C:\meep\meep-1.3\examples\, eg:
meep> bend-flux.ctl
I get the same error :
ERROR: Unbound variable: bend-flux.ctl
ABORT: (unbound-variable)
Any help to figure out how to run the .ctl files would be really helpful.

Trouble Installing ImageMagick for Windows

I just downloaded ImageMagick but am not sure if it's working. I typed in 'which convert' into my terminal and nothing happened. I also tried typing in 'convert logo: logo.gif' then 'identify logo.gif' and lastly 'display logo.gif' and nothing seemed to happen (these three commands were specified on Windows).
Then I tried following this video: http://www.youtube.com/watch?v=gEWAVlNCKhg
However, it still didn't work and on the last step of the video. I got the following error: ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: ----with-opt-include=C:/ImageMagick/SourceCode
Can anyone advise on how to correctly install imagemagick on windows or what these errors mean?
That video has a bunch of unnecessary stuff if all you want to do is get ImageMagick working as a standalone product on Windows. All you need to do is:
Download latest Windows binary from imagemagick.org. Right now, that file is located here.
Run the installer (leave all default values the way they are)
Open a command prompt (Start --> Run --> cmd.exe)
Navigate to the ImageMagick folder in the command prompt window. For the default install path, this is done as follows :
Change to the root directory of the C: drive (type cd\ followed by the enter key)
Change to the ImageMagick folder (type cd "Program Files\ImageMagick-6.8.6-Q16" followed by the enter key)
Test that it's working with the convert command: convert images\logo.jpg logo.gif
Look at the directory listing and check the for a logo.gif file with the current time/datestamp (dir logo.gif, followed by enter key).
Note: when you run the convert command, there will not be any output to the command prompt unless you turn on the verbose flag e.g. (convert -verbose images\logo.jpg logo.gif)
I noticed that in my installation that there was not a 'display.exe', but there was an 'imdisplay.exe". I tried using imdisplay in a folder that had images, and it did not how a window. I double clicked imdisplay.exe in the installation folder, and windows came up, including all of the ones I tried to open on the command line. When I closed all of those windows and tried the command line again, it worked.
I am not sure where you are getting 'which convert' (I did not watch the video). I can see all of the exe files that are available in the installation folder. convert.exe is one of them, so in a regular cmd window (I do not know anything about Powershell GitShell), you can just type:
convert logo.png logo.jpg
or something like that.

rubys> cd command not working in command line

I'm just getting into ruby and am trying to execute a walkthrough from Sam Ruby's Agile web development.
I've created a directory using mkdir work
Next i'm instructed to open a terminal and type rubys> cd work
The error I'm getting reads:
No command 'rubys' found, did you mean:
Command 'ruby' from package 'ruby' (main)
rubys: command not found
Can anyone inform me of what I'm doing wrong?
I've also tried changing from ~ to the work directory before entering my command.
In this book, rubys> is a command prompt, much like you have C:\> in the Windows terminal.
Ignore that first bit and everything should start working.
I guess you're doing it wrong.
mkdir work
creates a directory called "work". It has nothing to do with Ruby.
cd work
will then change into that directory. Forget about the rubys>.

I'm clearly missing something... 'ruby' doesn't work but './ruby' does (centos 5.5, installed from source)

Trying to get a rails server running nicely.
downloaded ruby 1.8.7 using link from rails page.
did ./configure/make/install, installed it fine.
tried ruby -v , got nothing.
tried ./ruby -v from the folder and it worked.
I feel like i've gone from understanding something about unix, to completely lost. Clearly ruby is working as a 'daemon', but not running as it should. Any help would be MUCH appreciated. Losing too much hair through this process :(
J.
can you see where make install put the ruby executeable?
if you do, check if this dir is in your $PATH by
echo $PATH
In general, unix needs to know where to find the executable file to be able to run it. It uses $PATH to find this executable file.
So if you type "ruby" it will go look at you $PATH and then look in each of those directories for a file named "ruby". If it can't find it in any of those directories it should then also look in the current directory.
So, this whole process will fail if:
a) the directory that contains the executable ruby file is not in any of the directories in $PATH AND
b) the executable is not in the current directory
... one more alternative is that is is available in one of these directories... but is not actually marked as being executable by you. You can check this by making sure you're int e directory with the ruby file and typing "ls -l ./ruby"
That will list the ruby file along with all its permissions and who owns it.
It should be something like:
lrwxrwxrwx 1 root root 7 2010-02-14 10:45 ./ruby
Notice the rwx. If your ruby doesn't have x then you'll need to add executable permission using chmod eg: "chmod 755 ./ruby"
Also note the "root root" - that means it's owned by root - in general, this means that only root can run it. In this particular example it has eXecute permission for everyone so everybody can run it, but if you do not have execute permission set like this, then it means that if you are trying to run it as yourself, you won't have permission, and you should either add full permissions or try running it using: "sudo ruby"
However - by the sounds of it - the most likely problem is that you just don't have the ruby executable's directory in your $PATH. You will need to fix this even if you get it running right now - because, in future, you will need to run ruby from directories other than the current one.
You will need to google for instructions on adding things to your $PATH - because it differs depending on your version of linux and your current shell, but it's not very difficult.
Which shell are you running? If tcsh, you may need a "rehash". Otherwise, as leifg says, add the directory containing the ruby executable to your path.

Resources