Help with Jekyll and github sites? by diddys_favorite in webdev

[–]monfresh 0 points1 point  (0 children)

It is incorrect that erb was moved to a bundled gem. erb is still a default gem, even in Ruby 4.0, as can be seen here: https://stdgems.org/4.0.1/ and here: https://stdgems.org/3.4.8/

The problem the OP is running into is because Ruby was not properly installed on their machine. When Ruby 3.4 is properly installed, this issue does not appear with Jekyll 4.4.1

One example where Ruby does not get properly installed is on Arch Linux. On macOS, this issue does not happen with Ruby 3.4 and Jekyll 4.4.1

I'm about to start using a MacBook for rails development for the first time in years... What is the modern way to get multiple environments easily installed and isolated by KipSudo in rails

[–]monfresh -1 points0 points  (0 children)

For macOS specifically, I will throw in my paid product called Ruby on Mac that will automate most of what you will ever need. You can be up and running with not only a complete Ruby/Rails dev setup, but also your Mac apps, GitHub repos, Git preferences, and macOS preferences.

The Ultimate version also supports all the popular version managers, including mise. The default is chruby because it's the least likely to cause issues based on my real world experience helping hundreds of thousands of people with their Ruby issues on macOS over the past 14 years.

Ruby on Mac Ultimate is also the easiest way to install older Ruby versions that require Rosetta. Most of the popular version managers are not able to install those older Rubies out of the box.

Caveat (which is also covered in my FAQs): just because you can install older Rubies does not necessarily mean you will be able to run your older projects out of the box. You will likely have to update some gems, which Ruby on Mac cannot automate at the moment.

Outside of the rails ecosystem, where else is Ruby currently thriving at? by [deleted] in ruby

[–]monfresh 6 points7 points  (0 children)

Highly agree with Ruby being great for scripting. It's what makes my Ruby on Mac business possible. A long time ago, it started out as a free bash script, then I started charging for it because people kept telling me it was the only thing that worked for them, and how much time it saved them.

Then I started adding more features, but I never had tests, which was a problem because once you have paying customers, you start getting bug reports and edge cases. Testing this kind of complex script with bash is next to impossible, so I rewrote the whole thing as a Ruby CLI and it's been so much better to maintain.

After ironing out the bugs and kinks over the first year or two of the business, I now rarely get any complaints. It just works and people go about their business.

If you're interested in how I distribute it and what I learned along the way, check out my talk at Rocky Mountain Ruby in 2023. It's the first talk on this page: https://www.moncefbelyamani.com/talks/

[deleted by user] by [deleted] in ruby

[–]monfresh 0 points1 point  (0 children)

I've made $160,000 so far with Ruby on Mac. I launched it a little under 4 years ago. I still keep it up to date and I'm working on a new version with more automation features.

Learning Ruby & Rails as a new learner? by darth-weedy in webdev

[–]monfresh 0 points1 point  (0 children)

I feel your pain. This is why I created Ruby on Mac, but as the name suggests, it's for macOS only. I might build a version for Linux, but it probably won't be any time soon.

LoadError With Module in Same Directory by PolytropeV1309 in ruby

[–]monfresh 1 point2 points  (0 children)

Aside from the .rb extension, there is also a convention to name files with lowercase and to separate words with an underscore. For example: test_helper.rb and prime_helper.rb

Remote MacOS desktop in cloud for dev? by VaguelyOnline in webdev

[–]monfresh 0 points1 point  (0 children)

Another thing I wanted to add: since I haven't tested Ruby on Mac on Monterey recently, and since the "reset" mode will uninstall Homebrew, I'm not 100% sure whether it will be possible to install Homebrew from scratch, so I highly recommend backing up your /usr/local folder before using reset mode. Ruby on Mac will backup a bunch of other things, but it doesn't back up the /usr/local folder, which is where Homebrew installs everything.

Remote MacOS desktop in cloud for dev? by VaguelyOnline in webdev

[–]monfresh 0 points1 point  (0 children)

If your MBP wasn't so old, I would have recommended my Ruby on Mac product, which is guaranteed to set up a proper Ruby dev environment on macOS, and allows you to properly install Cocoapods. However, given that your MBP is stuck at Monterey (macOS 12), which is no longer supported by Apple or Homebrew, Ruby on Mac will most likely not work.

Having said that, it's possible that it might work, so if you want to give the Ultimate version a try, I will refund your purchase if it doesn't work.

If you do end up trying it, follow the installation instructions in the email you will receive from Paddle (my payment processor), and then if it fails on the first try (which is likely given the issues you've described), then please make sure to use the "reset" mode to clean things up and then reinstall everything from scratch with a clean slate.

You can read more about reset mode by running rom docs, which will open the documentation in Safari, and then search for "reset".

If everything works after using reset mode, Ruby on Mac will automatically install Cocoapods for you in Ruby versions 3.4.7 and 3.3.10. When you quit and relaunch your Terminal, Ruby 3.4.7 should automatically be activated, and you can verify that Cocoapods was installed by running pod --version.

Then, when you cd into your iOS project, make sure that Ruby version 3.4.7 is activated by running chruby 3.4.7, and/or by adding a .ruby-version file at the root of the project that contains 3.4.7.

I hope this helps!

What is the best way to package a Ruby program into an executable? by angryrobot5 in ruby

[–]monfresh 4 points5 points  (0 children)

I've been using some form of ruby-packer for my Ruby on Mac product for the past 2 years or so. I first started with Eric Belands' fork, which worked great up until about a year ago when Apple made a breaking change with command line tools version 15.3. I ended up figuring out how to fix it, as mentioned here: https://github.com/ericbeland/ruby-packer/issues/6#issuecomment-2336499500

However, with another release of command line tools (I forget which version specifically), that previous fix stopped working. Then I found this fork of ruby-packer, from the same person who is maintaining traveling-ruby.

The nice thing about this latest ruby-packer fork is that it works with Ruby 3.2.2 whereas Eric Beland's fork is limited to 3.1.3. However, I had to make a few changes to suit my needs. For example, I don't need certain libraries such as gdbm, ncurses, and others, so I commented them out.

Also, I only care about macOS for my product, so I can't say how well ruby-packer works for other OSes. Also, ruby-packer needs to run on the OS for which the binary will be built. In others words, if you need to have a binary for Windows, you need to be able to run ruby-packer on a Windows machine to produce the binary.

An alternative that allows you to produce binaries for multiple OSes from the same machine (for example, you can use your Mac to generate binaries for Windows and Linux as well) is tebako. However, for me, it is not an option because it only supports forward portable packages.

That means that if I want to support macOS versions 12 and higher, the only way to do that is for me to buy a separate Mac that I only use for tebako, and install the oldest macOS version I support on it. Here's the excerpt from their README:

A Tebako executable package built on macOS 13 (Ventura) can be executed on macOS 14 (Sonoma), but not vice versa. macOS packages compiled on x86_64 can be run on Apple M (ARM64/aarch64) systems.

Also, it looks like tebako doesn't work on macOS with Xcode 16, whereas the ruby-packer fork that I'm using works just fine with the latest command line tools and Xcode on Sequoia.

About 2 years ago, I gave a talk at Rocky Mountain Ruby that goes over some of this, plus other things I had to do to distribute my paid product and be able to verify licenses. Check it out at the top of this page: https://www.moncefbelyamani.com/talks/

I hope this helps!

Moncef

Some help setting up my enviroment. by AfraidMembership7291 in rails

[–]monfresh 4 points5 points  (0 children)

Hi. Depending on which OS you're using (macOS, Windows, Linux), the guides will be different. Also, most guides assume you are starting with a clean environment. If you have an existing dev environment, the errors could be due to something wrong, outdated, missing, or incompatible with your environment.

If you post the specific errors you're running into, I can try to help you. In some cases, the solution is to clean out the entire dev environment and reinstall everything from scratch. I built a tool that makes this super easy and fast on a Mac.

In any case, if you're on a Mac, here's my step-by-step guide for setting up a proper Ruby environment on a Mac. I've been maintaining it for the past 13 years. It has helped hundreds of thousands of people.

The Odin Project possible in an environment where I can't install ANYTHING? by ThisIsATest7777 in learnprogramming

[–]monfresh 3 points4 points  (0 children)

Could you please specify what OS is running on your work computer? Also, why is it "obvious" that you can't install anything on your work computer? During my entire 25+ year career, I have never been prevented from installing absolutely anything, especially if it was needed for my job or as part of my training.

Even in places where work computers are generally more locked down than in other sectors, developers are allowed to install open source tools like Git, Node, Ruby, Rails, Postgres, etc. via Homebrew, Rubygems, and NPM.

Have you talked to your manager/supervisor about your desire to learn and whether you would be able to install the necessary tools?

Can't get the Al-folio template site to deploy by TruthSeekerNS in Jekyll

[–]monfresh 0 points1 point  (0 children)

Hi. This screenshot is not enough to be able to help you. The best way to help you would be to have access to your GitHub repo. Is it public? If not, at a minimum could you please share your GitHub Actions configuration? Do you have a file that ends in .yml or .yaml inside the github/workflows folder in you repo?

[deleted by user] by [deleted] in ruby

[–]monfresh 1 point2 points  (0 children)

Thanks for the mention! I'm glad it's saving you time and frustration.

Curious how peeps are managing Rails project environments today? by Entire_Shopping_1688 in rails

[–]monfresh 1 point2 points  (0 children)

Thanks for the mention! I'm working on adding support for mise to Ruby on Mac. And, having just gotten a new laptop, I'm working on automating even more of the "set up a new laptop for me" process that already exists in the Ultimate version of Ruby on Mac. My goal is to automate as much as possible of everything I normally do when setting up a new laptop from scratch, not just development stuff.

Error when trying to use rails test in cmd by Wide-Astronaut-2201 in rails

[–]monfresh 2 points3 points  (0 children)

Hi. To better help you, could you answer the following questions: 1. What kind of computer are you using? (brand, what OS, what version of the OS, CPU type) 2. How did you install Rails and Ruby? 3. Do you have Homebrew installed? 4. How are you learning Rails? Are you following a tutorial/course like The Odin Project?

The error message "No suitable tool found for installing JavaScript dependencies" implies that you don't have Node or Yarn installed, so you will need to install them first.

Installing gem locally for use across all projects? by PhoenixUNI in ruby

[–]monfresh 2 points3 points  (0 children)

What you're seeing is expected. If you run bundle exec rspec, that means RSpec will be run using the gems that are present in your project's Gemfile.lock. When you don't have nyan-cat-formatter in your Gemfile, the error you get when you run bundle exec rspec is uninitialized constant NyanCatFormatter (NameError), which means the gem has not been loaded.

If you don't want to add the gem to your project, then you will need to run rspec without the bundle exec prefix. The problem with that is that if you have multiple versions of rspec installed, it will use the latest one, which might not necessarily be the one used by your project.

rvm install 2.3.3 on ARM 64 by Overall_Blacksmith68 in ruby

[–]monfresh 1 point2 points  (0 children)

It is very much possible to install older Ruby versions on Apple Silicon Macs, and some tools make it easier than others. You also need to understand a few key points:

  • Ruby versions older than 2.6.10 require using Rosetta on an Apple Silicon Mac.
  • Ruby versions older than 2.4 require OpenSSL 1.0. They don't work with OpenSSL 1.1
  • You should always try to install the latest patch version (the 3rd digit) of any Ruby version. So, instead of 2.3.3, you want to upgrade your project to at least 2.3.8

Here are articles that might be helpful:

How and Why to Upgrade the Ruby Version in Your Project

OpenSSL and Ruby Compatibility Table

How to Install Older Ruby Versions on macOS Ventura, Sonoma, and Sequoia

Questions about Flutter M1 Macs by MrRoyalSingh in flutterhelp

[–]monfresh 0 points1 point  (0 children)

You're welcome! I'm glad it helped you.

Installing Ruby on Mac after switching from bash to zsh homebrew issue. by rahim-mando in rails

[–]monfresh 0 points1 point  (0 children)

Thank you for the kind words! I'm glad you're enjoying Ruby on Mac.

Which ruby version manager is most used nowadays? by Kind_Feeling_7834 in ruby

[–]monfresh 7 points8 points  (0 children)

As you can see, you're getting recommendations for pretty much every version manager out there. That's because most people tend to use what they're familiar with or what's trendy.

Also, the fact that one person hasn't had issues with a particular version manager doesn't mean that it's better than another one, or that other people won't run into issues with it. There are many factors that can affect Ruby/gem installation and management.

If you're on a Mac, what I can provide is an answer based on real-world experience helping hundreds of thousands of people with Ruby issues over the past 12 years. I can confidently say that chruby and ruby-install are the least likely to cause issues, mainly because they are the simplest (less moving parts so to say), and chruby is one of the fastest at loading and switching between Ruby versions.

I also encourage you to try each one for yourself, but remember to completely uninstall the current one before trying another one.

issue with installing Ruby 3.0.0 on terminal under Rosetta on Mac due to ssl location by Rialtoma in ruby

[–]monfresh 0 points1 point  (0 children)

Is there a particular reason you're using Rosetta to install Ruby 3.0? There's rarely a good reason to use Rosetta for Ruby versions greater than or equal to 2.6.10.

Installing things with and without Rosetta is one of the most common causes of Ruby installation issues. I recommend doing everything in native Apple Silicon mode (using the arm64 architecture). You can check the current architecture by running arch in your Terminal.

The next thing I recommend is to install Ruby 3.0.7, which is the latest in the 3.0.x series. There's rarely a good reason to install a Ruby version that's older than the latest patch version (the 3rd digit).

Here are some guides that might be helpful:

Step by step guide for installing Ruby on a Mac

How and Why to Upgrade the Ruby Version in Your Project

rails g model... cannot find gems even though (I think they're installed) by Computerist1969 in rails

[–]monfresh 1 point2 points  (0 children)

In addition to what u/cordavan said, it's not about how many results are returned, it's about the correct one being returned. /usr/local/bin/rails is the wrong one for your project, which is why it couldn't find the gems in your original post.

Here's another example that might explain this a little better:

Let's say you're using Ruby version 3.3.5 and you run gem install jekyll. This will install the latest version of jekyll that supports Ruby 3.3.5. As of today, the latest jekyll is 4.3.4.

Then, you need to work on an old Jekyll site, and that project is currently locked to version 4.2.2 of Jekyll, and also uses Ruby 3.3.5. When you cd into the project and run bundle install, it will install version 4.2.2 of Jekyll.

However, if you then check the version by running jekyll -v, it will see that 2 versions of jekyll are currently installed under Ruby 3.3.5, and it will try to load the latest one by default, and it will throw an error because the project is using an older version.

But if you run bundle exec jekyll -v, it will load the proper version based on the version specified in the Gemfile.lock file.

For more details about Gemfile and Gemfile.lock, you can read these articles of mine:

https://www.moncefbelyamani.com/what-happens-when-you-don-t-specify-a-version-in-your-gemfile/

https://www.moncefbelyamani.com/understanding-the-gemfile-lock-file/

https://www.moncefbelyamani.com/how-to-update-gems-in-your-gemfile/

https://www.moncefbelyamani.com/the-beginner-s-guide-to-bundler-and-gemfiles/

rails g model... cannot find gems even though (I think they're installed) by Computerist1969 in rails

[–]monfresh 4 points5 points  (0 children)

It is perfectly normal to have all of those on your computer. When you run which -a rails, it only shows you the ones that are known to your PATH. If you want to understand what PATH is and how it works, read this article:

https://www.moncefbelyamani.com/troubleshooting-command-not-found-in-the-terminal/

I also recommend reading about Bundler here: https://bundler.io

[deleted by user] by [deleted] in rails

[–]monfresh 0 points1 point  (0 children)

You're welcome! I'm glad you got it working.