Ruby, InSpec, and Terminal Customization Setup Guide (Windows)¶
Windows Development Environment
This guide provides a comprehensive setup for Ruby and InSpec development on Windows, including modern terminal customization for an enhanced developer experience.
1. Ruby Version Management¶
Recommended Tools
- RubyInstaller - Official Ruby distribution for Windows
- uru - Lightweight Ruby version manager for Windows
Installation Steps¶
- Download and install Ruby (with DevKit) from RubyInstaller.
- Install uru (via Chocolatey or manual download):
- Register each Ruby version:
- Switch versions:
- List registered Rubies:
Installing uru with Chocolatey
Chocolatey is the easiest way to install uru on Windows:
While the uru downloads page doesn't prominently mention this option, the uru installation wiki provides comprehensive details.
2. Disable Gem Documentation (Faster Installs)¶
Speed up gem installations
Create or edit %USERPROFILE%\.gemrc
to disable documentation generation:
3. Install InSpec and Related Gems¶
4. Terminal Customization¶
Modern Terminal Stack
Transform your Windows terminal into a powerful, beautiful development environment:
Essential Components¶
Install from Microsoft Store for a modern, GPU-accelerated terminal experience.
Install via winget or Chocolatey:
Prompt Customization¶
- Oh My Posh:
- Starship:
Nerd Fonts Required
Download and install a Nerd Font for proper icon display in your customized prompt. Popular choices include:
- FiraCode Nerd Font
- Meslo Nerd Font
- JetBrains Mono Nerd Font
5. Troubleshooting & Tips¶
Common Issues and Solutions
- Path Issues: Ensure Ruby's
bin
directory is in your PATH. - Permissions: Run terminals as a regular user unless you need admin rights.
- Native Gem Builds: May be slow on Windows VMs/Citrix; be patient.
- Switching Rubies: Use
uru
to change Ruby versions as needed.
Multiple Gem Versions
Check for multiple versions:
Uninstall old/conflicting versions:
Ruby Version Activation
Always activate the correct Ruby version with uru <label>
before installing or running gems.
SSL/Certificate Issues
If you encounter SSL errors with gem
or ruby
:
- Ensure your system certificates are up to date
- For organizational CAs, add the certificate to Windows certificate store:
- Update Ruby's certificate bundle if needed - see Ruby SSL Troubleshooting
FFI Troubleshooting
If you see ffi errors:
- Install with platform flag:
- Ensure you have a compatible Ruby and DevKit/MSYS2 environment
6. VS Code Setup¶
Enhanced Development Experience
- Install VS Code.
- Recommended extensions:
- Ruby
- Solargraph
- VSCode Ruby
- Test Explorer UI
- PowerShell (for Windows)
- Configure your terminal in VS Code to use Windows Terminal or PowerShell as preferred.
7. Resources¶
Resource | Description | Link |
---|---|---|
RubyInstaller | Official Ruby distribution for Windows | rubyinstaller.org |
uru | Lightweight Ruby version manager | bitbucket.org/jonforums/uru |
InSpec | Infrastructure testing framework | inspec.io |
Oh My Posh | Prompt theme engine for any shell | ohmyposh.dev |
Starship | Cross-shell prompt | starship.rs |
Nerd Fonts | Patched fonts with icons | nerdfonts.com |
8. Additional Best Practices & FAQ¶
Environment Isolation¶
Project Isolation with Bundler
- Use Bundler and a
Gemfile
for project-specific dependencies: Then run: - This helps avoid global gem conflicts and ensures consistent environments.
Automated Setup Script¶
Automation Opportunity
Consider creating a PowerShell script to automate the setup process for new team members, including Ruby installation, uru configuration, and gem setup.
Checking Ruby & Gem Health¶
- Verify your environment:
Proxy/Firewall/Corporate Network Issues¶
- If your organization uses a proxy, set these environment variables:
Windows Defender/Antivirus¶
- Some antivirus or Defender settings may block Ruby or gem executables. If you encounter issues, whitelist the Ruby install directory.
Sample PowerShell Profile¶
- Add this to your
$PROFILE
to auto-activate a Ruby version and set up your prompt:
Frequently Asked Questions¶
FAQ
- Why do I get SSL errors?
- Your system or Ruby certificates may be out of date. See the SSL/Certificate Issues section above.
- How do I fix ffi build errors?
- Ensure you have the correct DevKit/MSYS2 installed and try
gem install ffi --platform=ruby
. - How do I clean up old Ruby or gem versions?
- Use
uru admin rm <label>
to remove old Rubies, andgem uninstall <gemname>
to remove old gems. - How do I check which Ruby or gem is active?
- Run
ruby -v
,gem env
, andwhere inspec
to verify your environment.
9. Referenced Sources & Validation Summary¶
Official Documentation & References¶
- RubyInstaller for Windows
- uru Ruby Version Manager
- uru Installation Wiki
- InSpec
- RubyGems
- Bundler
- Oh My Posh
- Starship Prompt
- Nerd Fonts
- Windows Terminal
- PowerShell
- Chocolatey
- winget
- VS Code
- Ruby SSL Troubleshooting
Feel free to share this guide with your team or adapt it for your organization!