ruby/rubygems · error · Gem::CommandLineError
Please specify a gem name or a .gem file on the command line
Error message
Please specify a gem name or a .gem file on the command line
What it means
Error "Please specify a gem name or a .gem file on the command line" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/commands/specification_command.rb:79
Specific fields in the specification can be extracted in YAML format:
$ gem spec rake summary
--- Ruby based make-like utility.
...
EOF
end
def usage # :nodoc:
"#{program_name} [GEM_OR_FILE] [FIELD]"
end
def execute
specs = []
gem = options[:args].shift
unless gem
raise Gem::CommandLineError,
"Please specify a gem name or a .gem file on the command line"
end
case v = options[:version]
when String
req = Gem::Requirement.create v
when Gem::Requirement
req = v
else
raise Gem::CommandLineError, "Unsupported version type: '#{v}'"
end
if !req.none? && options[:all]
alert_error "Specify --all or -v, not both"
terminate_interaction 1
end
if options[:all]View on GitHub (pinned to 86cbb817a3)
When it happens
Trigger: Thrown at lib/rubygems/commands/specification_command.rb:79 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23).
Data as JSON: /api/errors/b7907eff39af1eac.
Report an issue: GitHub.