Unable to fix rails smtp.rb error - ruby-on-rails

I followed the post here,
Rails 3 - Devise/ActionMailer/RUBY-SMTP causing a segmentation fault
But, trying to add this variable to my home directory's .bashrc or .zshrc or .bash_profile does not seem to provide this variable. After adding RUBYOPT to these files, I tried to echo $RUBYOPT, but nothing comes on the screen.
Do I need to restart my laptop or add this variable somewhere else?

do the following:
$ echo 'export RUBYOPT="-ropenssl"' >> ~/.bashrc
$ source ~/.bashrc
and then see if you have RUBYOPT is set or not

Related

The command could not be located because '/snap/bin' is not included in the PATH environment variable

when i try to run git-all-secrets i got Dockerfile: command not found
and this is the command include correct information
here is an example of the issue
root#momo22:/home/momo/git-all-secrets# docker run -it abhartiya/tools_gitallsecrets -token=9a8b60a10cf683f238e05 -org=bugcrwod
Command 'docker' is available in '/snap/bin/docker'
The command could not be located because '/snap/bin' is not included in the PATH environment variable.
docker: command not found
root#momo22:/home/momo/git-all-secrets#
Temporary solution:
Run the command export PATH=$PATH:/snap/bin
Permanent solution:
Edit /etc/environment and add /snap/bin in the list then restart your system.
Links
answer for similar error with same fix
More info on /etc/enviroment
you can add the path into .bashrc file
$ echo 'export PATH=$PATH:/snap/bin' >> ~/.bashrc
open new terminal or execute this command
$ source ~/.bashrc
To fix this issue do the following:
Open the file /etc/environment.
Add /snap/bin to the end of the PATH Variable and concatenate using the : character.
Example lets assume we had the PATH variable in the file was: Path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
After your update this will look like: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin
Finally to update your shell and have the PATH variable ready to use, run source /etc/environment
Done
If you come here and are just on Ubuntu rather than docker and you have just installed snapd without logging out/in again, log out then in again - you don't need to modify any files.
Open the ~/.bashrc with nano or vim => vim ~/.bashrc
add export PATH=$PATH:/snap/bin at the end of the file
log out from your user and log in again or reboot
if ~/.bashrc doesn't exist:
create ~/.bashrc file and open it => touch ~/.bashrc && vim ~/.bashrc
add PATH=$PATH:/snap/bin
logout from your user and login again or reboot
if you don't want to logout or reboot run these commands:
sudo su ${USER}
bash
open ~/.bash_profile
add export PATH=$PATH:/snap/bin and save the changes
run source ~/.bash_profile
you can open ~/.bash_profile with vi or gedit

Extend $PATH variable in git bash under Windows

I'm trying to extend my $PATH variable in git bash (MinGW shell) by adding the following to the file ~/.bashrc
PATH=$PATH':/c/Program Files/maven/apache-maven-3.2.5/bin'
After I did this and restarted the bash it seems like that the $PATH variable was extended like expected:
$ echo $PATH
MANY_OTHER_PATHS:/c/Program Files/maven/apache-maven-3.2.5/bin
But I still cannot execute the programms in the given directory:
$ mvn
bash: mvn: command not found
What went wrong here? How do I extend the PATH variable correctly?
Here are two ideas.
You can have your path with double quote mark.
export PATH=$PATH:"/C/Program Files (x86)/apache-maven-3.3.3/bin"
Or, You can also make symbolic link for the directory.
ln -s "/C/Program Files (x86)/apache-maven-3.3.3/bin" ./mvnbin
export PATH=$PATH:/your-path/mvnbin
It works for me in mingw32 environment.
I needed to add something to my Git Bash path permanently each time I open it. It was Meld.exe path which can be added with:
export PATH=$PATH:"/C/Program Files (x86)/Meld/lib"
In order to execute this command each bash session, you need a ~/.bashrc file. Check if it already exists or create it using notepad ~/.bashrc or touch ~/.bashrc.
You can check where it is with:
echo ~
Open it and add the command that adds the PATH (first command in this response).
I hope you found this useful.
According to this SO post, you need to escape Program Files with quotes. git-bash $PATH cannot parse windows directory with space
Add PATH in Git Bash Permanently | Windows Only
Just in case you are still wondering how to add a path permanently in git bash here is the step-by-step process for Windows users:
Create .bashrc in user's root folder using the below command. It will open notepad and ask you to create the file, click yes.
notepad ~/.bashrc
Put the directory you want to add as below, for more than 1 items repeat the same format in next line:
export PATH=$PATH:"/c/folder/folder/"
Save the file and relaunch the bash.
Next launch will give you a warning like WARNING: Found ~/.bashrc but no ~/.bash_profile, ~/.bash_login or ~/.profile. but git bash will handle it by creating the required files.
SOME INSIGHTS
Git Bash doesn't fetch Window's environment PATH, it maintains its PATH separately in more like a Linux way.
You can run export PATH=$PATH:"/c/folder/folder/" in cmd to add a directory to path, but it will be only for the current session once you close the bash, it will be gone.
.bashrc is a shell script file that will be executed every time you launch a new git bash window. So you can add any type of bash command here. We simply added the export command to add our desired directory to PATH.

Editing the ~/.zshrc file

I'm a complete newbie, so I think I'm just missing a step, but have no idea.
I'm following tutorials for Rails. Lots of steps say, "and then editing the ~/.zshrc file." but I don't have any ~/.zshrc file. I'm looking at the folders in Sublime. Also none of the following ~/.zprofile, ~/.zlogin, ~/.zlogout exist. Though, under my home files, there is .zprezto folder. No zshenv either...
Do I just create the files? Seems like they should be downloaded from somewhere. I'm using Terminal with OS X. So lost.
echo 'write whatever' >.zshrc
Thanks in advance!
You will get ~/.zshrc file only when you use zsh shell on your Mac OS. If you're not sure which shell you're using, open terminal and issue the following command.
echo $SHELL
if you get response like /bin/zsh then you're using zsh shell on your Mac. You can edit ~/.zshrc file using vim editor on your Mac which is the default for Mac OS.
to open ~/.zshrc file using vim editor, issue the following command on your terminal.
vim ~/.zshrc
Then you can do any configurations you need. Or else you can use open -t .zshrc command to open ~/.zshrc file from your general TextEdit on Mac OS.
$ open ~/.zshrc
Make changes in the .zshrc file window that opens
Save file
$ source ~/.zshrc
The .zshrc file is used to configure your terminal prompt if you're using zsh (z-shell) login shell (n.b., a "login shell" is the command line presented to you when running the terminal application). If you're using a standard OSX terminal, then you're probably using bash (the BASH Shell), so editing .zshrc wouldn't affect anything. Bash uses .bashrc and .bash_profile` for it's configuration. These file are run overtime you open terminal window and setup things the command aliases, setup your prompt and maybe run scripts to initial other programs.
You almost certainly don't need to edit terminal config files to develop with Ruby on Rails, especially as editing these files incorrectly can mess up your system, or at least make it hard to return the system to a stable state.
I usually use the vi(vim) editor to edit the .zshrc file.
1)To open ~/.zshrc
vi .zshrc
or
vi ~/.zshrc
or
You can open the file in VsCode, and it would be easier to edit it.
code .zshrc
2)To update the edited .zshrc file:
source ~/.zshrc
or
source .zshrc
If you are using zsh shell , run the below lines in the terminal:
echo 'setopt PROMPT_CR' >.zshrc
echo 'setopt PROMPT_SP' >.zshrc
echo 'export PROMPT_EOL_MARK=""' >.zshrc
You can edit zshenv instead of zshrc for appending PATH . Please check whether file already exists
cat ~/.zshevn
You can edit file using below command
vi ~/.zshenv
You can refer this to see how to add an entry in PATH

Struggling to unset an environment variable in bash

I have previously set an environment variable using:
echo export "AVARIABLE=example" >> ~/.bash_profile
but now after using:
unset AVARIABLE
the env var remains when I open a new shell? What am I doing wrong here? Even running:
source ~/.bash_profile
does not work?
If you are opening a new shell, about the first thing it does is to source ~/.bash_profile. And there, the variable is set again.
If you want to get rid of it permanently, edit your ~/.bash_profile to remove the line in question again. (This will only take effect for new sessions.)
If you only want to unset it in your current shell, then unset is fine but as you've seen, it won't affect new invocations of the shell.

Using the Command-line Command to launch Sublime Text 2 on OS X

I just started reading Michael Hartl's book on Rails and I've run across a problem in the setup phase. Hartl keeps referring to making a file in my home directory, but I'm not quite sure how to do this. For example, when I try to setup the command line for sublime text the instructions tell me to do this: Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
My problem is that I don't know how to put a ~/bin directory in my path. I know this is real basic but any help would be greatly appreciation.
create or edit ~/.profile (works with both bash and zsh)
add the following
export PATH=$PATH:$HOME/bin
The line above is saying, overwrite the PATH environment variable and set it to the previous path plus ~/bin
Now when you try to run a command, bash will look in all the colon separated paths in your PATH environment variable for an executable.
To see your entire PATH, type echo $PATH in a terminal. Or better yet, type env to see all environment variables.
On your terminal
$ mkdir ~/bin
$ sudo ln -s "/Applications/Sublime Text2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
Edit ~/.base_profile
export PATH=$PATH:~/bin
usage:
open current directory:
subl .
In your ~/.bashrc file add to the end:
PATH="$HOME/bin:$PATH"

Resources